lib/units.rb in ruby-units-0.1.1 vs lib/units.rb in ruby-units-0.2.0
- old
+ new
@@ -59,11 +59,11 @@
#mass
'<kilogram>' => [%w{kg kilogram kilograms}, 1.0, :mass, %w{<kilogram>}],
'<AMU>' => [%w{u AMU amu}, 6.0221415e26, :mass, %w{<kilogram>}],
'<dalton>' => [%w{Da Dalton Daltons dalton daltons}, 6.0221415e26, :mass, %w{<kilogram>}],
'<slug>' => [%w{slug slugs}, 14.5939029, :mass, %w{<kilogram>}],
- '<short-ton>' => [%w{t ton}, 907.18474, :mass, %w{<kilogram>}],
+ '<short-ton>' => [%w{tn ton}, 907.18474, :mass, %w{<kilogram>}],
'<metric-ton>'=>[%w{tonne}, 1000, :mass, %w{<kilogram>}],
'<carat>' => [%w{ct carat carats}, 0.0002, :mass, %w{<kilogram>}],
'<pound-mass>' => [%w{lbs lb pound pounds #}, 0.45359237, :mass, %w{<kilogram>}],
'<ounce>' => [%w{oz ounce ounces}, 0.0283495231, :mass, %w{<kilogram>}],
'<gram>' => [%w{g gram grams gramme grammes},1e-3,:mass, %w{<kilogram>}],
@@ -86,16 +86,16 @@
'<kph>' => [%w{kph}, 0.277777778, :speed, %w{<meter>}, %w{<second>}],
'<mph>' => [%w{mph}, 0.44704, :speed, %w{<meter>}, %w{<second>}],
'<knot>' => [%w{kn knot knots}, 0.514444444, :speed, %w{<meter>}, %w{<second>}],
'<fps>' => [%w{fps}, 0.3048, :speed, %w{<meter>}, %w{<second>}],
- #temperature
- '<kelvin>' => [%w{degK kelvin Kelvin}, 1.0, :temperature, %w{<celcius>}],
- '<celcius>' => [%w{degC celcius Celcius}, 1.0, :temperature, %w{<celcius>}],
- '<farenheit>' => [%w{degF farenheit Farenheit}, 1.8, :temperature, %w{<celcius>}],
- '<rankine>' => [%w{degR rankine Rankine}, 1.8, :temperature, %w{<celcius>}],
-
+ #temperature_difference
+ '<kelvin>' => [%w{degK kelvin Kelvin}, 1.0, :temperature, %w{<kelvin>}],
+ '<celcius>' => [%w{degC celcius Celcius}, 1.0, :temperature, %w{<kelvin>}],
+ '<farenheit>' => [%w{degF farenheit Farenheit}, 1.8, :temperature, %w{<kelvin>}],
+ '<rankine>' => [%w{degR rankine Rankine}, 1.8, :temperature, %w{<kelvin>}],
+
#time
'<second>'=> [%w{s sec second seconds}, 1.0, :time, %w{<second>}],
'<minute>'=> [%w{min minute minutes}, 60.0, :time, %w{<second>}],
'<hour>'=> [%w{h hour hours}, 3600.0, :time, %w{<second>}],
'<day>'=> [%w{d day days}, 3600*24, :time, %w{<second>}],
@@ -107,13 +107,13 @@
#pressure
'<pascal>' => [%w{Pa pascal Pascal}, 1.0, :pressure, %w{<kilogram>},%w{<meter> <second> <second>}],
'<bar>' => [%w{bar bars}, 100000, :pressure, %w{<kilogram>},%w{<meter> <second> <second>}],
'<mmHg>' => [%w{mmHg}, 133.322368,:pressure, %w{<kilogram>},%w{<meter> <second> <second>}],
- '<torr>' => [%w{Torr}, 133.322368,:pressure, %w{<kilogram>},%w{<meter> <second> <second>}],
+ '<torr>' => [%w{torr}, 133.322368,:pressure, %w{<kilogram>},%w{<meter> <second> <second>}],
'<bar>' => [%w{bar}, 100000,:pressure, %w{<kilogram>},%w{<meter> <second> <second>}],
- '<atm>' => [%w{atm atmosphere atmospheres}, 101325,:pressure, %w{<kilogram>},%w{<meter> <second> <second>}],
+ '<atm>' => [%w{atm ATM atmosphere atmospheres}, 101325,:pressure, %w{<kilogram>},%w{<meter> <second> <second>}],
'<psi>' => [%w{psi}, 6894.76,:pressure, %w{<kilogram>},%w{<meter> <second> <second>}],
'<cmh2o>' => [%w{cmH2O}, 98.0638,:pressure, %w{<kilogram>},%w{<meter> <second> <second>}],
#viscosity
'<poise>' => [%w{P poise}, 0.1, :viscosity, %w{<kilogram>},%w{<meter> <second>} ],
@@ -172,11 +172,11 @@
#frequency
'<hertz>' => [%w{Hz hertz Hertz}, 1.0, :frequency, %w{<1>}, %{<second>}],
#angle
- '<radian>' =>[%w{rad radian radians}, 1.0, :angle, %w{<radian>}],
+ '<radian>' =>[%w{rad radian radian}, 1.0, :angle, %w{<radian>}],
'<degree>' =>[%w{deg degree degrees}, Math::PI / 180.0, :angle, %w{<radian>}],
'<grad>' =>[%w{grad gradian grads}, Math::PI / 200.0, :angle, %w{<radian>}],
'<steradian>' => [%w{sr steradian steradians}, 1.0, :solid_angle, %w{<steradian>}],
#rotation
@@ -213,14 +213,15 @@
'<each>' => [%w{each}, 1.0, :counting, %w{<each>}],
'<count>' => [%w{count}, 1.0, :counting, %w{<each>}],
'<base-pair>' => [%w{bp}, 1.0, :counting, %w{<each>}],
'<nucleotide>' => [%w{nt}, 1.0, :counting, %w{<each>}],
'<molecule>' => [%w{molecule molecules}, 1.0, :counting, %w{<each>}],
- '<dozen>' => [%w{dz doz dozen},12.0,:prefix],
+ '<dozen>' => [%w{doz dz dozen},12.0,:prefix_only, %w{<each>}],
'<percent>'=> [%w{% percent}, 0.01, :prefix_only, %w{<centi>}],
'<ppm>' => [%w{ppm},1e-6,:prefix_only, %w{<micro>}],
'<ppt>' => [%w{ppt},1e-9,:prefix_only, %w{<nano>}],
- '<gross>' => [%w{gr gross},144.0, :prefix_only, %w{<dozen> <dozen>}]
+ '<gross>' => [%w{gr gross},144.0, :prefix_only, %w{<dozen> <dozen>}],
+ '<decibel>' => [%w{dB decibel decibels}, 1.0, :logarithmic, %w{<decibel>}]
} # doc
end
\ No newline at end of file