Notes:
Signficantly improved functionality for units. Better parsing, improved error detection, more tests. Also works nicely with Time objects. See the Change Log for more information
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
* Improved parsing
|