Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

247 lines (216 sloc) 13.694 kb
Change Log for Ruby-units
2012-09-16 1.4.2 * Fix issue #54 -- pluralization of fluid-ounces
* Fix issue #53, 51 -- incorrect definition for gee
* Fix issue #52 -- add support for degree symbol
* Fix issue #50 -- fix conversion to json
2012-05-13 1.4.1 * Fix issue #40 -- Unit parsing truncates invalid portions of the unit
* Fix issue #41 -- initializing with a nil gives unexpected result
2012-02-01 * Fix issue #34 -- takes more than one parameter
* Fix issue #35 -- 'pt' is ambiguous
2012-01-02 1.4.0 * Fix some definitions that were just wrong (amu, dalton)
* Definition uses name of unit if no aliases provided
* Refactor definition process. New units are immediately available
2011-12-31 * Define standard units in terms of base and other standard units -- more internally consistent
and less prone to round-off errors.
* add 'poundal'
* remove 'wtpercent'
2011-12-30 * Bump version
* Define compound units with base units for consistency
* distinguish between a league and a nautical league
* NOTE: the new unit definition DSL is not backwardly compatible with the old method
(which is now deprecated).
* Fix issue #27
2011-12-18 * Can define a display_name for units (fixes #26)
2011-12-04 * Documentation improvements
* Add DSL for defining/redefining units
2011-11-24 * improve yard documentation
* add 'tbsp' as an alias for tablespoon
2011-10-17 1.3.2 * deprecate some string helper functions (make the gem compatible with rails)
* tighten up some time helper functions so they don't make as many assumptions
* time helpers no longer attempt to convert strings to time/date objects
2011-10-09 * Farads are not a base unit
* CFM added to default units
* multi specs run against ruby-1.9.3
* internally change Unit#to to Unit#convert_to, which is the preferred form
2011-04-23 1.3.0.a * Some internal restructuring
* Implement specs for core behaviors
* fixed several bugs found by specs
* implemented a few new methods for completeness
* specs run against 1.8.7, 1.9.2-head, jruby, and rubinius(rbx) using rvm
1.2.0 * Release 1.2.0 series
2010-11-07 1.2.0.a * a bunch of fixes to make ruby-units ruby 1.9 compatible
(ruby 1.9.3dev (2010-11-07 trunk 29711) [i386-darwin9.8.0])
2010-03-16 1.1.5 * another bugfix, and update url to point to github
2010-03-15 1.1.4 * fixed a couple of outstanding bugs
2007-12-13 1.1.3 * fixed a minor bug with string %
2007-12-12 1.1.2 * fixed a bug with format strings
* detect if ruby 1.8.6 is installed and use its' to_date function
2007-07-14 1.1.1 * fixed bug that would prevent creating '<pound-mass>' units, which
prevented rounding from working
* tests do not fail if Uncertain gem is not installed, you just get an
annoying warning message
2007-01-28 1.1.0 * completely revamped the temperature handling system (see README)
* fixed some spelling errors in some units
* fixed to_datetime and to_date to convert durations to datetimes and dates'
2007-01-24 1.0.2 * Minor changes in the way powers are calculated to support Uncertain
numbers better.
* Fixed parsing bug with Uncertain Numbers
* added resolution / typography units (pixels, points, pica)
Note that 'pt' means 'pints' and not 'points'
* added some pressure units ('inHg' & 'inH2O')
* changed default abbreviation of 'knots' to 'kt'
* Changed directory layout
* fixed a minor bug with Time.to_date so comparisons work properly
2007-01-17 1.0.1 * Force units are now defined correctly.
2007-01-12 1.0.0 * Improved handling of complex numbers. Now you can specify
'1+1i mm'.unit to get a complex unit.
* Taking the root of a negative unit will give you a complex unit
* fixed unary minus to work again
* Math.hypot now takes units. Both parameters must be the compatible
units or it will assert. Units will be converted to a common base
before use.
* Can now specify units in rational numbers, i.e., '1/4 cup'.unit
* Seems like a good time to move to 1.0 status
2006-12-15 0.3.9 * forgot to increment the version in the gem file..ooops.
2006-12-15 0.3.8 * Any object that supports a 'to_unit' method will now be
automatically coerced to a unit during math operations.
2006-12-14 0.3.7 * improved handling of percents and added a 'wt%' unit
equivalent to 1 g/dl.
* Improved handling for units with non-alphanumeric names
(like ' for feet, # for pound)
* Now you can enter durations as "HH:MM:SS, usec" or
2006-12-05 0.3.6 * Fixed bug where (unit/unit).ceil would fail
2006-11-20 0.3.5 * Minor bug fixes
* to_int now coerces the result to an actual Integer,
but only works properly for unitless Units.
2006-10-27 0.3.4 * Fixed a few more parsing bugs so that it will properly
complain about malformed units.
* Fixed a bug that prevents proper use of percents
* several minor tweaks
* some improved Date and DateTime handling
* can convert between Date, DateTime, and Time objects
* Time math will now return a DateTime if it goes out of
2006-10-03 0.3.3 * Apparently I can't do math late at night.
Fixed a bug that would cause problems when adding
or subtracting units to a unit with a zero scalar.
* Date and DateTime objects can be converted to 'units'
2006-10-03 0.3.2 * More minor bug fixes
(now fixes a minor name collision with rails)
2006-10-02 0.3.1 * minor bug fixes
2006-10-02 0.3.0 * Performance enhanced by caching results of many
functions (Thanks to Kurt Stephens for pushing this.)
* Throws an exception if the unit is not recognized
* units can now identify what 'kind' they are
(:length, :mass, etc..)
* New constructors:
2006-09-22 0.2.3 * added support for date/time parsing with the Chronic gem
parsing will use Chronic if it is loaded
* allows Date / Time / DateTime conversions
* better test coverage
* The 'string'.to_time returns a Time object
* 'string'.to_datetime returns a DateTime object
* 'string'.time returns a Time object or a DateTime if the
Time object fails
* 'string'.datetime returns a DateTime or a Time if the
DateTime fails
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"5 min")
* added Unit.to_unit to simplify some calls
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
( + "1 day".unit) => 2006-09-19
Does not work with months since they aren't a consistent
* Tweaked time usage a bit + "1 hr".unit => Mon Sep 18 11:51:29 EDT 2006
* can output time in 'hh:mm:ss' format by using
* added time helper methods
before(Time/DateTime), and
* Time helpers also work on strings. In this case they
are first converted to units
'5 min'.from_now
'1 week'.ago
'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
* can use U'1 mm' or '1 mm'.u to specify units now
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 + => 1.159e+09 s'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
* => 1.159e9 s
* works well with 'Uncertain' numerics
* Improved parsing
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''1 cm')
* Added ability to convert temperatures to absolute values
using the following syntax:
'37 degC''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
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.
* 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
* can now coerce or define units from arrays, strings,
"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-22 0.1.0 * Initial Release
Jump to Line
Something went wrong with that request. Please try again.