README.txt in ruby-units-1.1.0 vs README.txt in ruby-units-1.1.2

- old
+ new

@@ -1,13 +1,14 @@ =Ruby Units Kevin C. Olbrich, Ph.D. + kevin.olbrich@gmail.com http://www.sciwerks.com -Project page: http://rubyforge.org/projects/ruby-units +Project page: http://ruby-units.rubyforge.org/ruby-units ==Introduction Many technical applications make use of specialized calculations at some point. Frequently, these calculations require unit conversions to ensure accurate results. Needless to say, this is a pain to properly keep track of, and is prone to numerous errors. @@ -109,30 +110,30 @@ Several helpers have also been defined. Note: If you include the 'Chronic' gem, you can specify times in natural language. -'min'.since('9/18/06 3:00pm') -'min'.before('9/18/08 3:00pm') -'days'.until('1/1/07') -'5 min'.from(Time.now) -'5 min'.from_now -'5 min'.before_now -'5 min'.before(Time.now) -'10 min'.ago + 'min'.since('9/18/06 3:00pm') + 'min'.before('9/18/08 3:00pm') + 'days'.until('1/1/07') + '5 min'.from(Time.now) + '5 min'.from_now + '5 min'.before_now + '5 min'.before(Time.now) + '10 min'.ago Durations may be entered as 'HH:MM:SS, usec' and will be returned in 'hours'. -'1:00'.unit #=> 1 h -'0:30'.unit #=> 0.5 h -'0:30:30'.unit #=> 0.5 h + 30 sec + '1:00'.unit #=> 1 h + '0:30'.unit #=> 0.5 h + '0:30:30'.unit #=> 0.5 h + 30 sec If only one ":" is present, it is interpreted as the separator between hours and minutes. ==Ranges -[U('0 h')..U('10 h')].each {|x| p x} + [U('0 h')..U('10 h')].each {|x| p x} works so long as the starting point has an integer scalar ==Math functions All Trig math functions (sin, cos, sinh, hypot...) can take a unit as their parameter. It will be converted to radians and then used if possible. @@ -143,31 +144,31 @@ Temperature units (i.e., 'tempK') can be converted back and forth, and will take into account the differences in the zero points of the various scales. Differential temperature (e.g., '100 degC'.unit) units behave like most other units. -'37 tempC'.unit >> 'tempF' #=> 98.6 tempF + '37 tempC'.unit >> 'tempF' #=> 98.6 tempF Ruby-units will raise an exception if you attempt to create a temperature unit that would fall below absolute zero. Unit math on temperatures is fairly limited. -'100 tempC'.unit + '10 degC'.unit #=> '110 tempC'.unit -'100 tempC'.unit - '10 degC'.unit #=> '90 tempC'.unit -'100 tempC'.unit + '50 tempC'.unit #=> exception -'100 tempC'.unit - '50 tempC'.unit #=> '50 degC'.unit -'50 tempC'.unit - '100 tempC'.unit #=> '-50 degC'.unit -'100 tempC'.unit * [scalar] #=> '100*scalar tempC'.unit -'100 tempC'.unit / [scalar] #=> '100/scalar tempC'.unit -'100 tempC'.unit * [unit] #=> exception -'100 tempC'.unit / [unit] #=> exception -'100 tempC'.unit ** N #=> exception + '100 tempC'.unit + '10 degC'.unit #=> '110 tempC'.unit + '100 tempC'.unit - '10 degC'.unit #=> '90 tempC'.unit + '100 tempC'.unit + '50 tempC'.unit #=> exception + '100 tempC'.unit - '50 tempC'.unit #=> '50 degC'.unit + '50 tempC'.unit - '100 tempC'.unit #=> '-50 degC'.unit + '100 tempC'.unit * [scalar] #=> '100*scalar tempC'.unit + '100 tempC'.unit / [scalar] #=> '100/scalar tempC'.unit + '100 tempC'.unit * [unit] #=> exception + '100 tempC'.unit / [unit] #=> exception + '100 tempC'.unit ** N #=> exception -'100 tempC'.unit >> 'degC' #=> '100 degC'.unit - This conversion references the 0 point on the scale of the temperature unit + '100 tempC'.unit >> 'degC' #=> '100 degC'.unit +This conversion references the 0 point on the scale of the temperature unit -'100 degC'.unit >> 'tempC' #=> '-173 tempC'.unit - These conversions are always interpreted as being relative to absolute zero. - Conversions are probably better done like this... - '0 tempC'.unit + '100 degC'.unit #=> '100 tempC'.unit + '100 degC'.unit >> 'tempC' #=> '-173 tempC'.unit +These conversions are always interpreted as being relative to absolute zero. +Conversions are probably better done like this... + '0 tempC'.unit + '100 degC'.unit #=> '100 tempC'.unit