eymiha_units 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. data/gem_package.rb +4 -4
  2. data/html/classes/Eymiha/AmbiguousUnitsException.html +119 -0
  3. data/html/classes/Eymiha/MissingUnitsException.html +119 -0
  4. data/html/classes/Eymiha/NumericWithUnits.html +867 -0
  5. data/html/classes/Eymiha/NumericWithUnits.src/M000021.html +18 -0
  6. data/html/classes/Eymiha/NumericWithUnits.src/M000022.html +18 -0
  7. data/html/classes/Eymiha/NumericWithUnits.src/M000023.html +18 -0
  8. data/html/classes/Eymiha/NumericWithUnits.src/M000024.html +30 -0
  9. data/html/classes/Eymiha/NumericWithUnits.src/M000025.html +30 -0
  10. data/html/classes/Eymiha/NumericWithUnits.src/M000027.html +18 -0
  11. data/html/classes/Eymiha/NumericWithUnits.src/M000028.html +20 -0
  12. data/html/classes/Eymiha/NumericWithUnits.src/M000029.html +32 -0
  13. data/html/classes/Eymiha/NumericWithUnits.src/M000030.html +18 -0
  14. data/html/classes/Eymiha/NumericWithUnits.src/M000031.html +30 -0
  15. data/html/classes/Eymiha/NumericWithUnits.src/M000032.html +30 -0
  16. data/html/classes/Eymiha/NumericWithUnits.src/M000033.html +22 -0
  17. data/html/classes/Eymiha/NumericWithUnits.src/M000034.html +22 -0
  18. data/html/classes/Eymiha/NumericWithUnits.src/M000035.html +32 -0
  19. data/html/classes/Eymiha/NumericWithUnits.src/M000036.html +32 -0
  20. data/html/classes/Eymiha/NumericWithUnits.src/M000037.html +18 -0
  21. data/html/classes/Eymiha/NumericWithUnits.src/M000038.html +18 -0
  22. data/html/classes/Eymiha/NumericWithUnits.src/M000039.html +24 -0
  23. data/html/classes/Eymiha/NumericWithUnits.src/M000040.html +26 -0
  24. data/html/classes/Eymiha/NumericWithUnits.src/M000041.html +18 -0
  25. data/html/classes/Eymiha/NumericWithUnits.src/M000042.html +18 -0
  26. data/html/classes/Eymiha/NumericWithUnits.src/M000043.html +18 -0
  27. data/html/classes/Eymiha/NumericWithUnits.src/M000044.html +20 -0
  28. data/html/classes/Eymiha/NumericWithUnits.src/M000045.html +18 -0
  29. data/html/classes/Eymiha/NumericWithUnits.src/M000046.html +25 -0
  30. data/html/classes/Eymiha/NumericWithUnits.src/M000047.html +18 -0
  31. data/html/classes/Eymiha/NumericWithUnits.src/M000048.html +19 -0
  32. data/html/classes/Eymiha/Units.html +378 -0
  33. data/html/classes/Eymiha/Units.src/M000052.html +18 -0
  34. data/html/classes/Eymiha/Units.src/M000053.html +18 -0
  35. data/html/classes/Eymiha/Units.src/M000054.html +20 -0
  36. data/html/classes/Eymiha/Units.src/M000055.html +30 -0
  37. data/html/classes/Eymiha/Units.src/M000056.html +33 -0
  38. data/html/classes/Eymiha/Units.src/M000057.html +18 -0
  39. data/html/classes/Eymiha/Units.src/M000058.html +21 -0
  40. data/html/classes/Eymiha/Units.src/M000059.html +18 -0
  41. data/html/classes/Eymiha/Units.src/M000060.html +18 -0
  42. data/html/classes/Eymiha/Units.src/M000061.html +18 -0
  43. data/html/classes/Eymiha/Units.src/M000062.html +18 -0
  44. data/html/classes/Eymiha/Units.src/M000063.html +18 -0
  45. data/html/classes/Eymiha/Units.src/M000064.html +28 -0
  46. data/html/classes/Eymiha/UnitsException.html +119 -0
  47. data/html/classes/Eymiha/UnitsHash.html +351 -0
  48. data/html/classes/Eymiha/UnitsHash.src/M000002.html +18 -0
  49. data/html/classes/Eymiha/UnitsHash.src/M000003.html +26 -0
  50. data/html/classes/Eymiha/UnitsHash.src/M000004.html +25 -0
  51. data/html/classes/Eymiha/UnitsHash.src/M000005.html +18 -0
  52. data/html/classes/Eymiha/UnitsHash.src/M000006.html +18 -0
  53. data/html/classes/Eymiha/UnitsHash.src/M000007.html +18 -0
  54. data/html/classes/Eymiha/UnitsHash.src/M000008.html +22 -0
  55. data/html/classes/Eymiha/UnitsHash.src/M000010.html +21 -0
  56. data/html/classes/Eymiha/UnitsHash.src/M000011.html +19 -0
  57. data/html/classes/Eymiha/UnitsHash.src/M000012.html +27 -0
  58. data/html/classes/Eymiha/UnitsHash.src/M000013.html +18 -0
  59. data/html/classes/Eymiha/UnitsMeasure.html +302 -0
  60. data/html/classes/Eymiha/UnitsMeasure.src/M000014.html +23 -0
  61. data/html/classes/Eymiha/UnitsMeasure.src/M000015.html +18 -0
  62. data/html/classes/Eymiha/UnitsMeasure.src/M000016.html +18 -0
  63. data/html/classes/Eymiha/UnitsMeasure.src/M000017.html +18 -0
  64. data/html/classes/Eymiha/UnitsMeasure.src/M000018.html +18 -0
  65. data/html/classes/Eymiha/UnitsMeasure.src/M000019.html +18 -0
  66. data/html/classes/Eymiha/UnitsMeasure.src/M000020.html +18 -0
  67. data/html/classes/Eymiha/UnitsSystem.html +196 -0
  68. data/html/classes/Eymiha/UnitsSystem.src/M000050.html +31 -0
  69. data/html/classes/Eymiha/UnitsSystem.src/M000051.html +18 -0
  70. data/html/classes/Eymiha/UnitsUnit.html +166 -0
  71. data/html/classes/Eymiha/UnitsUnit.src/M000049.html +18 -0
  72. data/html/classes/Eymiha.html +143 -0
  73. data/html/classes/Numeric.html +182 -0
  74. data/html/classes/Numeric.src/M000001.html +50 -0
  75. data/html/created.rid +1 -0
  76. data/html/files/lib/eymiha/units/definitions/area_rb.html +101 -0
  77. data/html/files/lib/eymiha/units/definitions/length_rb.html +101 -0
  78. data/html/files/lib/eymiha/units/definitions/mass_rb.html +101 -0
  79. data/html/files/lib/eymiha/units/definitions/measures_rb.html +113 -0
  80. data/html/files/lib/eymiha/units/definitions/time_rb.html +101 -0
  81. data/html/files/lib/eymiha/units/definitions/velocity_rb.html +101 -0
  82. data/html/files/lib/eymiha/units/definitions/volume_rb.html +101 -0
  83. data/html/files/lib/eymiha/units/numeric_rb.html +116 -0
  84. data/html/files/lib/eymiha/units/numeric_with_units_rb.html +109 -0
  85. data/html/files/lib/eymiha/units/object_rb.html +108 -0
  86. data/html/files/lib/eymiha/units/units_exception_rb.html +101 -0
  87. data/html/files/lib/eymiha/units/units_hash_rb.html +108 -0
  88. data/html/files/lib/eymiha/units/units_measure_rb.html +109 -0
  89. data/html/files/lib/eymiha/units/units_rb.html +115 -0
  90. data/html/files/lib/eymiha/units/units_system_rb.html +109 -0
  91. data/html/files/lib/eymiha/units/units_unit_rb.html +109 -0
  92. data/html/files/lib/eymiha/units_rb.html +115 -0
  93. data/html/fr_class_index.html +37 -0
  94. data/html/fr_file_index.html +43 -0
  95. data/html/fr_method_index.html +90 -0
  96. data/html/index.html +24 -0
  97. data/html/rdoc-style.css +208 -0
  98. data/lib/{units → eymiha/units}/definitions/area.rb +0 -0
  99. data/lib/{units → eymiha/units}/definitions/length.rb +0 -0
  100. data/lib/{units → eymiha/units}/definitions/mass.rb +0 -0
  101. data/lib/eymiha/units/definitions/measures.rb +6 -0
  102. data/lib/{units → eymiha/units}/definitions/time.rb +0 -0
  103. data/lib/{units → eymiha/units}/definitions/velocity.rb +0 -0
  104. data/lib/{units → eymiha/units}/definitions/volume.rb +0 -0
  105. data/lib/{units → eymiha/units}/numeric.rb +4 -3
  106. data/lib/eymiha/units/numeric_with_units.rb +640 -0
  107. data/lib/{units → eymiha/units}/object.rb +1 -1
  108. data/lib/eymiha/units/units.rb +234 -0
  109. data/lib/eymiha/units/units_exception.rb +18 -0
  110. data/lib/eymiha/units/units_hash.rb +118 -0
  111. data/lib/eymiha/units/units_measure.rb +95 -0
  112. data/lib/eymiha/units/units_system.rb +89 -0
  113. data/lib/eymiha/units/units_unit.rb +63 -0
  114. data/lib/eymiha/units.rb +4 -0
  115. data/test/tc_definitions.rb +1 -1
  116. data/test/tc_formatting.rb +2 -2
  117. data/test/tc_formatting_derived.rb +2 -2
  118. data/test/tc_measure_create.rb +2 -2
  119. data/test/tc_measure_derive.rb +2 -2
  120. data/test/tc_system_create.rb +2 -2
  121. data/test/tc_unit_ambiguity.rb +2 -2
  122. data/test/tc_unit_arithmetic.rb +2 -2
  123. data/test/tc_unit_create.rb +2 -2
  124. data/test/tc_unit_derive.rb +2 -2
  125. data/test/tc_unit_equality.rb +2 -2
  126. data/test/tc_unit_forward_reference.rb +2 -2
  127. data/test/tc_unit_greek.rb +2 -2
  128. data/test/tc_unit_hash.rb +2 -2
  129. data/test/tc_unit_identifiers.rb +2 -2
  130. data/test/tc_unit_rank.rb +2 -2
  131. data/test/tc_uses_1.rb +2 -2
  132. data/test/tc_uses_2.rb +2 -2
  133. metadata +190 -86
  134. data/lib/units/definitions/measures.rb +0 -6
  135. data/lib/units/numeric_with_units.rb +0 -635
  136. data/lib/units/units.rb +0 -229
  137. data/lib/units/units_exception.rb +0 -14
  138. data/lib/units/units_hash.rb +0 -112
  139. data/lib/units/units_measure.rb +0 -91
  140. data/lib/units/units_system.rb +0 -85
  141. data/lib/units/units_unit.rb +0 -60
  142. data/lib/units.rb +0 -4
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>new (Eymiha::UnitsHash)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/eymiha/units/units_hash.rb, line 15</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">unit</span> = <span class="ruby-keyword kw">nil</span>,<span class="ruby-identifier">power</span> = <span class="ruby-value">1</span>) <span class="ruby-comment cmt"># :nodoc</span>
15
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">unit</span>
16
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">unit</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">UnitsUnit</span>
17
+ <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">unit</span>] = <span class="ruby-identifier">power</span>
18
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">unit</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">UnitsHash</span>
19
+ <span class="ruby-identifier">unit</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span><span class="ruby-operator">*</span><span class="ruby-identifier">power</span> }
20
+ <span class="ruby-keyword kw">else</span>
21
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">UnitsException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;invalid unit: #{unit}&quot;</span>)
22
+ <span class="ruby-keyword kw">end</span>
23
+ <span class="ruby-keyword kw">end</span>
24
+ <span class="ruby-keyword kw">end</span></pre>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>to_s (Eymiha::UnitsHash)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/eymiha/units/units_hash.rb, line 30</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">numeric</span> = <span class="ruby-value">1</span>,<span class="ruby-identifier">use_abbrevs</span> = <span class="ruby-keyword kw">false</span>)
15
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-operator">&amp;&amp;</span>
16
+ (<span class="ruby-identifier">su</span> = <span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>}).<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-operator">&amp;&amp;</span>
17
+ <span class="ruby-operator">!</span><span class="ruby-identifier">use_abbrevs</span>
18
+ <span class="ruby-identifier">su</span> = <span class="ruby-identifier">su</span>.<span class="ruby-identifier">to_a</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>]
19
+ ((<span class="ruby-identifier">numeric</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)<span class="ruby-operator">?</span> <span class="ruby-identifier">su</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">su</span>.<span class="ruby-identifier">plural</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/_/</span>,<span class="ruby-value str">' '</span>)
20
+ <span class="ruby-keyword kw">else</span>
21
+ <span class="ruby-identifier">abbrevs_to_s</span>
22
+ <span class="ruby-keyword kw">end</span>
23
+ <span class="ruby-keyword kw">end</span></pre>
24
+ </body>
25
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>power! (Eymiha::UnitsHash)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/eymiha/units/units_hash.rb, line 53</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">power!</span>(<span class="ruby-identifier">power</span>)
15
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span><span class="ruby-operator">*</span><span class="ruby-identifier">power</span> }
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>** (Eymiha::UnitsHash)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/eymiha/units/units_hash.rb, line 59</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">**</span>(<span class="ruby-identifier">power</span>)
15
+ <span class="ruby-identifier">clone</span>.<span class="ruby-identifier">power!</span>(<span class="ruby-identifier">power</span>)
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>merge (Eymiha::UnitsHash)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/eymiha/units/units_hash.rb, line 65</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">value</span>,<span class="ruby-identifier">power</span>=<span class="ruby-value">1</span>)
15
+ <span class="ruby-identifier">clone</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">value</span>,<span class="ruby-identifier">power</span>)
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>merge! (Eymiha::UnitsHash)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/eymiha/units/units_hash.rb, line 71</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">value</span>,<span class="ruby-identifier">power</span>=<span class="ruby-value">1</span>)
15
+ <span class="ruby-identifier">value</span>.<span class="ruby-identifier">unit</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
16
+ <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">k</span>] = (<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">v</span><span class="ruby-operator">*</span><span class="ruby-identifier">power</span>
17
+ <span class="ruby-identifier">delete</span> <span class="ruby-identifier">k</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
18
+ }
19
+ <span class="ruby-keyword kw">self</span>
20
+ <span class="ruby-keyword kw">end</span></pre>
21
+ </body>
22
+ </html>
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>measure (Eymiha::UnitsHash)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/eymiha/units/units_hash.rb, line 82</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">measure</span>
15
+ <span class="ruby-identifier">measure</span> = <span class="ruby-constant">UnitsMeasure</span>.<span class="ruby-identifier">new</span>
16
+ <span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">unit</span>,<span class="ruby-identifier">power</span><span class="ruby-operator">|</span>
17
+ <span class="ruby-identifier">measure</span>.<span class="ruby-identifier">merge_derivation</span> <span class="ruby-identifier">unit</span>.<span class="ruby-identifier">units_system</span>.<span class="ruby-identifier">units_measure</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">power</span> }
18
+ <span class="ruby-constant">Units</span>.<span class="ruby-identifier">find_by_derivation</span>(<span class="ruby-identifier">measure</span>.<span class="ruby-identifier">derived</span>)
19
+ <span class="ruby-keyword kw">end</span></pre>
20
+ </body>
21
+ </html>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>derived? (Eymiha::UnitsHash)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/eymiha/units/units_hash.rb, line 90</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">derived?</span>
15
+ <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">select</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">unit</span><span class="ruby-operator">|</span>
16
+ <span class="ruby-identifier">unit</span>.<span class="ruby-identifier">units_system</span>.<span class="ruby-identifier">units_measure</span>.<span class="ruby-identifier">derived</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>}.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
17
+ <span class="ruby-keyword kw">end</span></pre>
18
+ </body>
19
+ </html>
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>reduce (Eymiha::UnitsHash)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/eymiha/units/units_hash.rb, line 97</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reduce</span>
15
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;UnitsHash:reduce #{to_s}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@debug</span>
16
+ <span class="ruby-identifier">factor</span> = <span class="ruby-value">1.0</span>
17
+ <span class="ruby-identifier">new_unit</span> = <span class="ruby-constant">UnitsHash</span>.<span class="ruby-identifier">new</span>
18
+ <span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">unit</span>,<span class="ruby-identifier">power</span><span class="ruby-operator">|</span>
19
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot; #{unit} #{power}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@debug</span>
20
+ <span class="ruby-identifier">factor</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">unit</span>.<span class="ruby-identifier">equals</span>.<span class="ruby-identifier">numeric</span><span class="ruby-operator">**</span><span class="ruby-identifier">power</span>
21
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot; #{factor}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@debug</span>
22
+ <span class="ruby-identifier">new_unit</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">unit</span>.<span class="ruby-identifier">equals</span>,<span class="ruby-identifier">power</span>)
23
+ <span class="ruby-keyword kw">end</span>
24
+ <span class="ruby-identifier">factor</span>.<span class="ruby-identifier">unite</span> <span class="ruby-identifier">new_unit</span>
25
+ <span class="ruby-keyword kw">end</span></pre>
26
+ </body>
27
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>has_units? (Eymiha::UnitsHash)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/eymiha/units/units_hash.rb, line 112</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_units?</span>
15
+ (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span><span class="ruby-value">.0</span>}).<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,302 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Eymiha::UnitsMeasure</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Eymiha::UnitsMeasure</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/eymiha/units/units_measure_rb.html">
59
+ lib/eymiha/units/units_measure.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ MethodicHash
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <p>
83
+ A <a href="UnitsMeasure.html">UnitsMeasure</a> groups sets of units that
84
+ measure the same quality.
85
+ </p>
86
+
87
+ </div>
88
+
89
+
90
+ </div>
91
+
92
+ <div id="method-list">
93
+ <h3 class="section-bar">Methods</h3>
94
+
95
+ <div class="name-list">
96
+ <a href="#M000018">*</a>&nbsp;&nbsp;
97
+ <a href="#M000016">**</a>&nbsp;&nbsp;
98
+ <a href="#M000017">/</a>&nbsp;&nbsp;
99
+ <a href="#M000020">format</a>&nbsp;&nbsp;
100
+ <a href="#M000015">names</a>&nbsp;&nbsp;
101
+ <a href="#M000014">system</a>&nbsp;&nbsp;
102
+ <a href="#M000019">to_s</a>&nbsp;&nbsp;
103
+ </div>
104
+ </div>
105
+
106
+ </div>
107
+
108
+
109
+ <!-- if includes -->
110
+
111
+ <div id="section">
112
+
113
+
114
+
115
+
116
+
117
+ <div id="attribute-list">
118
+ <h3 class="section-bar">Attributes</h3>
119
+
120
+ <div class="name-list">
121
+ <table>
122
+ <tr class="top-aligned-row context-row">
123
+ <td class="context-item-name">derived</td>
124
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
125
+ <td class="context-item-desc">
126
+ A Hash of UnitsMeasures to powers that represent the bases for this <a
127
+ href="UnitsMeasure.html">UnitsMeasure</a> if it is derived.
128
+
129
+ </td>
130
+ </tr>
131
+ <tr class="top-aligned-row context-row">
132
+ <td class="context-item-name">formats</td>
133
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
134
+ <td class="context-item-desc">
135
+ A Methodic Hash mapping <a href="UnitsMeasure.html#M000015">names</a> of
136
+ formats to procs that implement them.
137
+
138
+ </td>
139
+ </tr>
140
+ </table>
141
+ </div>
142
+ </div>
143
+
144
+
145
+
146
+ <!-- if method_list -->
147
+ <div id="methods">
148
+ <h3 class="section-bar">Public Instance methods</h3>
149
+
150
+ <div id="method-M000018" class="method-detail">
151
+ <a name="M000018"></a>
152
+
153
+ <div class="method-heading">
154
+ <a href="UnitsMeasure.src/M000018.html" target="Code" class="method-signature"
155
+ onclick="popupCode('UnitsMeasure.src/M000018.html');return false;">
156
+ <span class="method-name">*</span><span class="method-args">(factor)</span>
157
+ </a>
158
+ </div>
159
+
160
+ <div class="method-description">
161
+ <p>
162
+ Returns a new <a href="UnitsMeasure.html">UnitsMeasure</a> equal to the
163
+ instance multiplied by another <a
164
+ href="UnitsMeasure.html">UnitsMeasure</a>. This is typically used to derive
165
+ UnitsMeasures - for example, if length is a <a
166
+ href="UnitsMeasure.html">UnitsMeasure</a>, then length*length could be used
167
+ as the target to derive area.
168
+ </p>
169
+ </div>
170
+ </div>
171
+
172
+ <div id="method-M000016" class="method-detail">
173
+ <a name="M000016"></a>
174
+
175
+ <div class="method-heading">
176
+ <a href="UnitsMeasure.src/M000016.html" target="Code" class="method-signature"
177
+ onclick="popupCode('UnitsMeasure.src/M000016.html');return false;">
178
+ <span class="method-name">**</span><span class="method-args">(exponent)</span>
179
+ </a>
180
+ </div>
181
+
182
+ <div class="method-description">
183
+ <p>
184
+ Returns a new <a href="UnitsMeasure.html">UnitsMeasure</a> equal to the
185
+ instance raised to the given power. This is typically used to derive
186
+ UnitsMeasures - for example, if length is a <a
187
+ href="UnitsMeasure.html">UnitsMeasure</a>, then length**3 could be used as
188
+ the target to derive volume.
189
+ </p>
190
+ </div>
191
+ </div>
192
+
193
+ <div id="method-M000017" class="method-detail">
194
+ <a name="M000017"></a>
195
+
196
+ <div class="method-heading">
197
+ <a href="UnitsMeasure.src/M000017.html" target="Code" class="method-signature"
198
+ onclick="popupCode('UnitsMeasure.src/M000017.html');return false;">
199
+ <span class="method-name">/</span><span class="method-args">(divisor)</span>
200
+ </a>
201
+ </div>
202
+
203
+ <div class="method-description">
204
+ <p>
205
+ Returns a new <a href="UnitsMeasure.html">UnitsMeasure</a> equal to the
206
+ instance divided by another <a href="UnitsMeasure.html">UnitsMeasure</a>.
207
+ This is typically used to derive UnitsMeasures - for example, if mass and
208
+ volume are UnitsMeasures, then mass/volume could be used as the target to
209
+ derive density.
210
+ </p>
211
+ </div>
212
+ </div>
213
+
214
+ <div id="method-M000020" class="method-detail">
215
+ <a name="M000020"></a>
216
+
217
+ <div class="method-heading">
218
+ <a href="UnitsMeasure.src/M000020.html" target="Code" class="method-signature"
219
+ onclick="popupCode('UnitsMeasure.src/M000020.html');return false;">
220
+ <span class="method-name">format</span><span class="method-args">(options)</span>
221
+ </a>
222
+ </div>
223
+
224
+ <div class="method-description">
225
+ <p>
226
+ Associates the name of a <a href="UnitsMeasure.html#M000020">format</a>
227
+ with an output formatter.
228
+ </p>
229
+ </div>
230
+ </div>
231
+
232
+ <div id="method-M000015" class="method-detail">
233
+ <a name="M000015"></a>
234
+
235
+ <div class="method-heading">
236
+ <a href="UnitsMeasure.src/M000015.html" target="Code" class="method-signature"
237
+ onclick="popupCode('UnitsMeasure.src/M000015.html');return false;">
238
+ <span class="method-name">names</span><span class="method-args">()</span>
239
+ </a>
240
+ </div>
241
+
242
+ <div class="method-description">
243
+ <p>
244
+ Returns the <a href="UnitsMeasure.html#M000015">names</a> by which this <a
245
+ href="UnitsMeasure.html">UnitsMeasure</a> is known.
246
+ </p>
247
+ </div>
248
+ </div>
249
+
250
+ <div id="method-M000014" class="method-detail">
251
+ <a name="M000014"></a>
252
+
253
+ <div class="method-heading">
254
+ <a href="UnitsMeasure.src/M000014.html" target="Code" class="method-signature"
255
+ onclick="popupCode('UnitsMeasure.src/M000014.html');return false;">
256
+ <span class="method-name">system</span><span class="method-args">(name,&amp;block)</span>
257
+ </a>
258
+ </div>
259
+
260
+ <div class="method-description">
261
+ <p>
262
+ Defines or extends a <a href="UnitsSystem.html">UnitsSystem</a>. During
263
+ definition, if forward references between entities may occur and when
264
+ encountered, are stored. Upon completion of the definition, if any existing
265
+ unresolved still exist, an attempt is made to resolve them.
266
+ </p>
267
+ </div>
268
+ </div>
269
+
270
+ <div id="method-M000019" class="method-detail">
271
+ <a name="M000019"></a>
272
+
273
+ <div class="method-heading">
274
+ <a href="UnitsMeasure.src/M000019.html" target="Code" class="method-signature"
275
+ onclick="popupCode('UnitsMeasure.src/M000019.html');return false;">
276
+ <span class="method-name">to_s</span><span class="method-args">()</span>
277
+ </a>
278
+ </div>
279
+
280
+ <div class="method-description">
281
+ <p>
282
+ Returns a String containing the <a
283
+ href="UnitsMeasure.html#M000015">names</a> of this <a
284
+ href="UnitsMeasure.html">UnitsMeasure</a> and the namse of the UnitsSystems
285
+ defined within it.
286
+ </p>
287
+ </div>
288
+ </div>
289
+
290
+
291
+ </div>
292
+
293
+
294
+ </div>
295
+
296
+
297
+ <div id="validator-badges">
298
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
299
+ </div>
300
+
301
+ </body>
302
+ </html>
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>system (Eymiha::UnitsMeasure)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/eymiha/units/units_measure.rb, line 25</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">system</span>(<span class="ruby-identifier">name</span>,<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
15
+ <span class="ruby-constant">Units</span>.<span class="ruby-identifier">defining</span> <span class="ruby-keyword kw">self</span>
16
+ <span class="ruby-identifier">system</span> = (<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">name</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">UnitsSystem</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>,<span class="ruby-identifier">name</span>))
17
+ <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">system</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
18
+ <span class="ruby-constant">Units</span>.<span class="ruby-identifier">resolve_forward_references</span>
19
+ <span class="ruby-constant">Units</span>.<span class="ruby-identifier">defining</span> <span class="ruby-keyword kw">nil</span>
20
+ <span class="ruby-identifier">system</span>
21
+ <span class="ruby-keyword kw">end</span></pre>
22
+ </body>
23
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>names (Eymiha::UnitsMeasure)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/eymiha/units/units_measure.rb, line 35</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">names</span>
15
+ <span class="ruby-constant">Units</span>.<span class="ruby-identifier">names_of</span> <span class="ruby-keyword kw">self</span>
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>** (Eymiha::UnitsMeasure)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/eymiha/units/units_measure.rb, line 43</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">**</span>(<span class="ruby-identifier">exponent</span>)
15
+ <span class="ruby-constant">UnitsMeasure</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">merge_derivation</span>(<span class="ruby-keyword kw">self</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exponent</span>)
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>/ (Eymiha::UnitsMeasure)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/eymiha/units/units_measure.rb, line 51</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">/</span>(<span class="ruby-identifier">divisor</span>)
15
+ <span class="ruby-constant">UnitsMeasure</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">merge_derivation</span>(<span class="ruby-keyword kw">self</span>).<span class="ruby-identifier">merge_derivation</span>(<span class="ruby-identifier">divisor</span>,<span class="ruby-value">-1</span>)
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>