ruby-units 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +52 -6
- data/README +1 -1
- data/lib/ruby-units.rb +383 -196
- data/lib/ruby_units.rb +1 -0
- data/lib/units.rb +13 -12
- data/test/test_ruby-units.rb +148 -59
- metadata +4 -3
data/CHANGELOG
CHANGED
@@ -1,15 +1,61 @@
|
|
1
1
|
Change Log for Ruby-units
|
2
2
|
=========================
|
3
3
|
2006-08-22 0.1.0 * Initial Release
|
4
|
-
|
5
|
-
|
4
|
+
|
5
|
+
2006-08-22 0.1.1 * Added new format option "1 mm".to_unit("in") now
|
6
|
+
converts the result to the indicated units
|
7
|
+
* Fixed some naming issues so that the gem name matches
|
8
|
+
the require name.
|
6
9
|
* Added CHANGELOG
|
7
10
|
* Improved test coverage (100% code coverage via RCov)
|
8
|
-
* fixed a bug that prevented units with a prefix in the
|
9
|
-
|
10
|
-
* can
|
11
|
+
* fixed a bug that prevented units with a prefix in the
|
12
|
+
denominator from converting properly
|
13
|
+
* can use .unit method on a string to create a new unit
|
14
|
+
object
|
15
|
+
* can now coerce or define units from arrays, strings,
|
16
|
+
numerics.
|
11
17
|
"1 mm".unit + [1, 'mm'] === "2 mm".unit
|
12
18
|
[1,'mm','s'].unit === "1 mm/s".unit
|
13
19
|
2.5.unit === "2.5".unit
|
14
20
|
* Added instructions on how to add custom units
|
15
|
-
|
21
|
+
|
22
|
+
2006-08-28 0.2.0 * Added 'ruby_unit.rb' file so that requires will still
|
23
|
+
work if the wrong name is used
|
24
|
+
* Added 'to' as an alias to '>>' so conversions can be
|
25
|
+
done as '1 m'.unit.to('1 cm')
|
26
|
+
* Added ability to convert temperatures to absolute values
|
27
|
+
using the following syntax:
|
28
|
+
'37 degC'.unit.to('tempF') #=> '98.6 degF'.unit
|
29
|
+
* Tweaked abbreviations a bit. 'ton' is now 'tn' instead
|
30
|
+
of 't'. It was causing parse collisions with 'atm'.
|
31
|
+
* fixed a bug in term elimination routine
|
32
|
+
* fixed a bug in parsing of powers, and added support for
|
33
|
+
'm**2' format
|
34
|
+
* Added support for taking roots of units. Just
|
35
|
+
exponentiate with a fraction (0.5, 1.0/3, 0.25)
|
36
|
+
* renamed 'quantity' to 'scalar'
|
37
|
+
* any type of Numeric can be used to initialize a Unit,
|
38
|
+
although this can't really be done with a string
|
39
|
+
* Units can not be forced to a float using to_f unless
|
40
|
+
they are unitless. This prevents some math functions
|
41
|
+
from forcing the conversion. To get the scalar, just
|
42
|
+
use 'unit.scalar'
|
43
|
+
* 'inspect' returns string representation
|
44
|
+
* better edge-case detection with math functions.
|
45
|
+
"0 mm".unit**-1 now throws a ZeroDivisionError exception
|
46
|
+
* Ranges can make a series of units, so long as the end
|
47
|
+
points have integer scalars.
|
48
|
+
* Fixed a parsing bug with feet/pounds and scientific
|
49
|
+
numbers
|
50
|
+
2006-09-17 * can now use the '%' format specifier like
|
51
|
+
'%0.2f' % '1 mm'.unit #=> '1.00 mm'
|
52
|
+
* works nicely with time now.
|
53
|
+
'1 week'.unit + Time.now => 1.159e+09 s
|
54
|
+
Time.at('1.159e+09 s'.unit)
|
55
|
+
=> Sat Sep 23 04:26:40 EDT 2006
|
56
|
+
"1.159e9 s".unit.time
|
57
|
+
=> Sat Sep 23 04:26:40 EDT 2006
|
58
|
+
* Time.now.unit => 1.159e9 s
|
59
|
+
* works well with 'Uncertain' numerics
|
60
|
+
* Improved parsing
|
61
|
+
|