Change Log for Ruby-units ========================= 2018-03-06 2.3.0 * Fix add (+) and subtract (-) for BigDecimal scalars. (see #167) * Update ruby versions (#163) * fix: temperature converting rational issue (#164) 2017-12-07 2.2.1 * fix an issue with formatting of rational scalars (see #159) 2017-08-07 2.2.0 * add support for ruby 2.4.1 * drop support for ruby 2.1.0 * remove dependency on mathn (see #157) 2016-12-28 2.1.0 * add support for ruby 2.4.0 * allow configuration for optional separator on output * Fix issue #105 -- change 'grad' to 'gon' 2015-11-07 2.0.0 * remove support for ruby versions less than 2.0 * remove `.unit` and `.u` from String * remove `.unit` from Date * Fix an issue with redefining units that have already been cached * remove 'U()' and 'u()' constructors * Fix issue #123 -- Fixes for singular unit parsing 2015-07-16 * Fix issue #129 -- doesn't handle number in the denominator 2015-05-09 * update test harness to use rspec 3 2014-02-21 1.4.5 * Fix issue #98 -- add mcg as a valid unit 2013-07-19 1.4.4 * Fix issue #4 -- .best_prefix method * Fix issue #60 -- Consider placing Unit in a module * Fix issue #75 -- Siemens is kind of conductance not resistance * Fix issue #36 -- Don't require spaces in units * Fix issue #68 -- ditto * Fix issue #16 -- ditto 2013-06-11 1.4.3 * Fix issue #70 -- Support passing Time objects to Time.at * Fix issue #72 -- Remove non-existent RakeFile from gemspec * Fix issue #71 -- Fix YAML test failure * Fix issue #49 -- Unit instances constructed using other Unit instances are incompatible within the framework * Fix issue #61 -- Fix failing case of subtraction losing Units class * Fix issue #63 -- fixes an issue with to_date on 1.8.7 * Fix issue #64 -- Aliases aren't considered in Unit.defined? method 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 -- Time.at 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 '' 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 "HH:MM:SS:usec" 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 range. 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: Unit(1,"mm") Unit(1,"mm/s") Unit(1,"mm","s") 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 Time.in("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 (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-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-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-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-22 0.1.0 * Initial Release