-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup SI unit system to load piecemeal. Also important to note that t…
…he definitions of prefixes changed slightly because Rational(1, 1e24) is not exactly the same as Rational(1, 10**24)
- Loading branch information
Showing
6 changed files
with
48 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require_relative '../definition_collection' | ||
require_relative 'si_base' | ||
require_relative 'si_prefixes' | ||
require_relative 'si_derived' | ||
require_relative '../unit_system' | ||
|
||
RubyUnits::UnitSystem.new('International System of Units', :si) | ||
|
||
Dir['./lib/ruby_units/unit_definitions/si/*.rb'].each { |file| require file } |
2 changes: 1 addition & 1 deletion
2
lib/ruby_units/unit_definitions/si_base.rb → ...ruby_units/unit_definitions/si/si_base.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
RubyUnits::UnitSystem.registered[:si].extend do | ||
{ | ||
googol: [%w(googol), 10**100], | ||
yobi: [%w(Yi Yobi yobi), 2**80], | ||
zebi: [%w(Zi Zebi zebi), 2**70], | ||
exbi: [%w(Ei Exbi exbi), 2**60], | ||
pebi: [%w(Pi Pebi pebi), 2**50], | ||
tebi: [%w(Ti Tebi tebi), 2**40], | ||
gibi: [%w(Gi Gibi gibi), 2**30], | ||
mebi: [%w(Mi Mebi mebi), 2**20], | ||
kibi: [%w(Ki Kibi kibi), 2**10], | ||
yotta: [%w(Y Yotta yotta), 10**24], | ||
zetta: [%w(Z Zetta zetta), 10**21], | ||
exa: [%w(E Exa exa), 10**18], | ||
peta: [%w(P Peta peta), 10**15], | ||
tera: [%w(T Tera tera), 10**12], | ||
giga: [%w(G Giga giga), 10**9], | ||
mega: [%w(M Mega mega), 10**6], | ||
kilo: [%w(k kilo), 10**3], | ||
hecto: [%w(h Hecto hecto), 10**2], | ||
deca: [%w(da Deca deca deka), 10**1], | ||
deci: [%w(d Deci deci), Rational(1, 10**1)], | ||
centi: [%w(c Centi centi), Rational(1, 10**2)], | ||
milli: [%w(m Milli milli), Rational(1, 10**3)], | ||
micro: [%w(u µ Micro micro mc), Rational(1, 10**6)], | ||
nano: [%w(n Nano nano), Rational(1, 10**9)], | ||
pico: [%w(p Pico pico), Rational(1, 10**12)], | ||
femto: [%w(f Femto femto), Rational(1, 10**15)], | ||
atto: [%w(a Atto atto), Rational(1, 10**18)], | ||
zepto: [%w(z Zepto zepto), Rational(1, 10**21)], | ||
yocto: [%w(y Yocto yocto), Rational(1, 10**24)] | ||
}.each do |name, definition| | ||
prefix(name) do | ||
scalar definition.last | ||
aliases definition.first | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters