Notes:
Minor update to fix a few issues with temperatures. See the CHANGELOG for details
Changes:
Change Log for Ruby-units
=========================
2006-08-22 0.1.0 * Initial Release
2006-08-22 0.1.1 * Added new format option \"1 mm\".to_unit(\"in\") now
converts the result to the indicated units
* Fixed some naming issues so that the gem name matches
the require name.
* Added CHANGELOG
* Improved test coverage (100% code coverage via RCov)
* fixed a bug that prevented units with a prefix in the
denominator from converting properly
* can use .unit method on a string to create a new unit
object
* can now coerce or define units from arrays, strings,
numerics.
\"1 mm\".unit + [1, \'mm\'] === \"2 mm\".unit
[1,\'mm\',\'s\'].unit === \"1 mm/s\".unit
2.5.unit === \"2.5\".unit
* Added instructions on how to add custom units
2006-08-28 0.2.0 * Added \'ruby_unit.rb\' file so that requires will still
work if the wrong name is used
* Added \'to\' as an alias to \'>>\' so conversions can be
done as \'1 m\'.unit.to(\'1 cm\')
* Added ability to convert temperatures to absolute values
using the following syntax:
\'37 degC\'.unit.to(\'tempF\') #=> \'98.6 degF\'.unit
* Tweaked abbreviations a bit. \'ton\' is now \'tn\' instead
of \'t\'. It was causing parse collisions with \'atm\'.
* fixed a bug in term elimination routine
* fixed a bug in parsing of powers, and added support for
\'m**2\' format
* Added support for taking roots of units. Just
exponentiate with a fraction (0.5, 1.0/3, 0.25)
* renamed \'quantity\' to \'scalar\'
* any type of Numeric can be used to initialize a Unit,
although this can\'t really be done with a string
* Units can not be forced to a float using to_f unless
they are unitless. This prevents some math functions
from forcing the conversion. To get the scalar, just
use \'unit.scalar\'
* \'inspect\' returns string representation
* better edge-case detection with math functions.
\"0 mm\".unit**-1 now throws a ZeroDivisionError exception
* Ranges can make a series of units, so long as the end
points have integer scalars.
* Fixed a parsing bug with feet/pounds and scientific
numbers
2006-09-17 * can now use the \'%\' format specifier like
\'%0.2f\' % \'1 mm\'.unit #=> \'1.00 mm\'
* works nicely with time now.
\'1 week\'.unit + Time.now => 1.159e+09 s
Time.at(\'1.159e+09 s\'.unit)
=> Sat Sep 23 04:26:40 EDT 2006
\"1.159e9 s\".unit.time
=> Sat Sep 23 04:26:40 EDT 2006
* Time.now.unit => 1.159e9 s
* works well with \'Uncertain\' numerics
(www.rubyforge.org/projects/uncertain)
* Improved parsing
2006-09-18 0.2.1 * Trig math functions (sin, cos, tan, sinh, cosh, tanh)
accept units that can be converted to radians
Math.sin(\"90 deg\".unit) => 1.0
* Date and DateTime can be offset by a time unit
(Date.today + \"1 day\".unit) => 2006-09-19
Does not work with months since they aren\'t a consistent
size
* Tweaked time usage a bit
Time.now + \"1 hr\".unit => Mon Sep 18 11:51:29 EDT 2006
* can output time in \'hh:mm:ss\' format by using
\'unit.to_s(:time)\'
* added time helper methods
ago,
since(Time/DateTime),
until(Time/DateTime),
from(Time/DateTime),
before(Time/DateTime), and
after(Time/DateTime)
* Time helpers also work on strings. In this case they
are first converted to units
\'5 min\'.from_now
\'1 week\'.ago
\'min\'.since(time)
\'min\'.until(time)
\'1 day\'.from()
* Can pass Strings to time helpers and they will be parsed
with ParseDate
* Fixed most parsing bugs (I think)
* Can pass a strftime format string to to_s to format time
output
* can use U\'1 mm\' or \'1 mm\'.u to specify units now
2006-09-19 0.2.2 * tweaked temperature handling a bit. Now enter
temperatures like this:
\'0 tempC\'.unit #=> 273.15 degK
They will always be converted to kelvin to avoid
problems when temperatures are used in equations.
* added Time.in(\"5 min\")
* added Unit.to_unit to simplify some calls
|