quantitymanager 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/doc/classes/Array.html +159 -0
- data/doc/classes/Array.src/M000001.html +21 -0
- data/doc/classes/Array.src/M000002.html +19 -0
- data/doc/classes/Array.src/M000040.html +21 -0
- data/doc/classes/Array.src/M000041.html +19 -0
- data/doc/classes/CalculatorTest.html +332 -0
- data/doc/classes/CalculatorTest.src/M000022.html +33 -0
- data/doc/classes/CalculatorTest.src/M000023.html +28 -0
- data/doc/classes/CalculatorTest.src/M000024.html +25 -0
- data/doc/classes/CalculatorTest.src/M000025.html +34 -0
- data/doc/classes/CalculatorTest.src/M000026.html +27 -0
- data/doc/classes/CalculatorTest.src/M000027.html +28 -0
- data/doc/classes/CalculatorTest.src/M000028.html +26 -0
- data/doc/classes/CalculatorTest.src/M000029.html +25 -0
- data/doc/classes/CalculatorTest.src/M000030.html +26 -0
- data/doc/classes/CalculatorTest.src/M000031.html +31 -0
- data/doc/classes/CalculatorTest.src/M000032.html +23 -0
- data/doc/classes/CalculatorTest.src/M000033.html +23 -0
- data/doc/classes/CalculatorTest.src/M000034.html +32 -0
- data/doc/classes/CalculatorTest.src/M000035.html +20 -0
- data/doc/classes/CompasedUnitTest.html +279 -0
- data/doc/classes/CompasedUnitTest.src/M000001.html +32 -0
- data/doc/classes/CompasedUnitTest.src/M000002.html +31 -0
- data/doc/classes/CompasedUnitTest.src/M000003.html +28 -0
- data/doc/classes/CompasedUnitTest.src/M000004.html +28 -0
- data/doc/classes/CompasedUnitTest.src/M000005.html +31 -0
- data/doc/classes/CompasedUnitTest.src/M000006.html +23 -0
- data/doc/classes/CompasedUnitTest.src/M000007.html +30 -0
- data/doc/classes/CompasedUnitTest.src/M000008.html +24 -0
- data/doc/classes/CompasedUnitTest.src/M000009.html +27 -0
- data/doc/classes/CompasedUnitTest.src/M000010.html +24 -0
- data/doc/classes/Configuration.html +184 -0
- data/doc/classes/Configuration.src/M000003.html +19 -0
- data/doc/classes/Configuration.src/M000004.html +18 -0
- data/doc/classes/Configuration.src/M000005.html +18 -0
- data/doc/classes/Configuration.src/M000006.html +24 -0
- data/doc/classes/Configuration.src/M000042.html +19 -0
- data/doc/classes/Configuration.src/M000043.html +18 -0
- data/doc/classes/Configuration.src/M000044.html +18 -0
- data/doc/classes/Configuration.src/M000045.html +24 -0
- data/doc/classes/ConfigurationTest.html +182 -0
- data/doc/classes/ConfigurationTest.src/M000065.html +31 -0
- data/doc/classes/ConfigurationTest.src/M000066.html +27 -0
- data/doc/classes/ConfigurationTest.src/M000067.html +35 -0
- data/doc/classes/ConfigurationTest.src/M000068.html +24 -0
- data/doc/classes/CustomUnitConversionTest.html +212 -0
- data/doc/classes/CustomUnitConversionTest.src/M000052.html +31 -0
- data/doc/classes/CustomUnitConversionTest.src/M000053.html +25 -0
- data/doc/classes/CustomUnitConversionTest.src/M000054.html +20 -0
- data/doc/classes/CustomUnitConversionTest.src/M000055.html +26 -0
- data/doc/classes/CustomUnitConversionTest.src/M000056.html +26 -0
- data/doc/classes/CustomUnitConversionTest.src/M000057.html +24 -0
- data/doc/classes/Numeric.html +125 -0
- data/doc/classes/QuantifiableTest.html +189 -0
- data/doc/classes/QuantifiableTest.src/M000036.html +24 -0
- data/doc/classes/QuantifiableTest.src/M000037.html +26 -0
- data/doc/classes/QuantifiableTest.src/M000038.html +41 -0
- data/doc/classes/QuantifiableTest.src/M000039.html +23 -0
- data/doc/classes/Quantity/Calculable.html +213 -0
- data/doc/classes/Quantity/Calculable.src/M000010.html +18 -0
- data/doc/classes/Quantity/Calculable.src/M000011.html +18 -0
- data/doc/classes/Quantity/Calculable.src/M000012.html +18 -0
- data/doc/classes/Quantity/Calculable.src/M000013.html +18 -0
- data/doc/classes/Quantity/Calculable.src/M000014.html +21 -0
- data/doc/classes/Quantity/Calculable.src/M000015.html +18 -0
- data/doc/classes/Quantity/Calculable.src/M000072.html +18 -0
- data/doc/classes/Quantity/Calculable.src/M000073.html +18 -0
- data/doc/classes/Quantity/Calculable.src/M000074.html +18 -0
- data/doc/classes/Quantity/Calculable.src/M000075.html +18 -0
- data/doc/classes/Quantity/Calculable.src/M000076.html +21 -0
- data/doc/classes/Quantity/Calculable.src/M000077.html +18 -0
- data/doc/classes/Quantity/Calculator.html +240 -0
- data/doc/classes/Quantity/Calculator.src/M000021.html +20 -0
- data/doc/classes/Quantity/Calculator.src/M000022.html +18 -0
- data/doc/classes/Quantity/Calculator.src/M000023.html +26 -0
- data/doc/classes/Quantity/Calculator.src/M000024.html +23 -0
- data/doc/classes/Quantity/Calculator.src/M000025.html +31 -0
- data/doc/classes/Quantity/Calculator.src/M000026.html +25 -0
- data/doc/classes/Quantity/Calculator.src/M000083.html +20 -0
- data/doc/classes/Quantity/Calculator.src/M000084.html +18 -0
- data/doc/classes/Quantity/Calculator.src/M000085.html +26 -0
- data/doc/classes/Quantity/Calculator.src/M000086.html +23 -0
- data/doc/classes/Quantity/Calculator.src/M000087.html +31 -0
- data/doc/classes/Quantity/Calculator.src/M000088.html +25 -0
- data/doc/classes/Quantity/Measurable.html +153 -0
- data/doc/classes/Quantity/Measurable.src/M000008.html +18 -0
- data/doc/classes/Quantity/Measurable.src/M000009.html +18 -0
- data/doc/classes/Quantity/Measurable.src/M000070.html +18 -0
- data/doc/classes/Quantity/Measurable.src/M000071.html +18 -0
- data/doc/classes/Quantity/OperationInfo.html +184 -0
- data/doc/classes/Quantity/OperationInfo.src/M000027.html +24 -0
- data/doc/classes/Quantity/OperationInfo.src/M000028.html +21 -0
- data/doc/classes/Quantity/OperationInfo.src/M000089.html +24 -0
- data/doc/classes/Quantity/OperationInfo.src/M000090.html +21 -0
- data/doc/classes/Quantity/Quantifiable.html +131 -0
- data/doc/classes/Quantity/Quantifiable.src/M000007.html +18 -0
- data/doc/classes/Quantity/Quantifiable.src/M000069.html +18 -0
- data/doc/classes/Quantity/Quantity.html +211 -0
- data/doc/classes/Quantity/Quantity.src/M000016.html +20 -0
- data/doc/classes/Quantity/Quantity.src/M000017.html +20 -0
- data/doc/classes/Quantity/Quantity.src/M000018.html +20 -0
- data/doc/classes/Quantity/Quantity.src/M000078.html +20 -0
- data/doc/classes/Quantity/Quantity.src/M000079.html +20 -0
- data/doc/classes/Quantity/Quantity.src/M000080.html +20 -0
- data/doc/classes/Quantity/QuantityInfo.html +179 -0
- data/doc/classes/Quantity/QuantityInfo.src/M000019.html +19 -0
- data/doc/classes/Quantity/QuantityInfo.src/M000020.html +18 -0
- data/doc/classes/Quantity/QuantityInfo.src/M000081.html +19 -0
- data/doc/classes/Quantity/QuantityInfo.src/M000082.html +18 -0
- data/doc/classes/Quantity.html +121 -0
- data/doc/classes/QuantityTest.html +220 -0
- data/doc/classes/QuantityTest.src/M000046.html +32 -0
- data/doc/classes/QuantityTest.src/M000047.html +33 -0
- data/doc/classes/QuantityTest.src/M000048.html +27 -0
- data/doc/classes/QuantityTest.src/M000049.html +20 -0
- data/doc/classes/QuantityTest.src/M000050.html +22 -0
- data/doc/classes/QuantityTest.src/M000051.html +20 -0
- data/doc/classes/SimpleUnitTest.html +234 -0
- data/doc/classes/SimpleUnitTest.src/M000058.html +24 -0
- data/doc/classes/SimpleUnitTest.src/M000059.html +25 -0
- data/doc/classes/SimpleUnitTest.src/M000060.html +21 -0
- data/doc/classes/SimpleUnitTest.src/M000061.html +20 -0
- data/doc/classes/SimpleUnitTest.src/M000062.html +26 -0
- data/doc/classes/SimpleUnitTest.src/M000063.html +21 -0
- data/doc/classes/SimpleUnitTest.src/M000064.html +18 -0
- data/doc/classes/SpecParserTest.html +174 -0
- data/doc/classes/SpecParserTest.src/M000019.html +25 -0
- data/doc/classes/SpecParserTest.src/M000020.html +32 -0
- data/doc/classes/SpecParserTest.src/M000021.html +31 -0
- data/doc/classes/Test.html +101 -0
- data/doc/classes/Unit/Comparable.html +156 -0
- data/doc/classes/Unit/Comparable.src/M000030.html +22 -0
- data/doc/classes/Unit/Comparable.src/M000031.html +22 -0
- data/doc/classes/Unit/Comparable.src/M000092.html +22 -0
- data/doc/classes/Unit/Comparable.src/M000093.html +22 -0
- data/doc/classes/Unit/ComposedUnit.html +301 -0
- data/doc/classes/Unit/ComposedUnit.src/M000044.html +22 -0
- data/doc/classes/Unit/ComposedUnit.src/M000045.html +25 -0
- data/doc/classes/Unit/ComposedUnit.src/M000046.html +25 -0
- data/doc/classes/Unit/ComposedUnit.src/M000047.html +22 -0
- data/doc/classes/Unit/ComposedUnit.src/M000048.html +29 -0
- data/doc/classes/Unit/ComposedUnit.src/M000049.html +24 -0
- data/doc/classes/Unit/ComposedUnit.src/M000050.html +25 -0
- data/doc/classes/Unit/ComposedUnit.src/M000051.html +18 -0
- data/doc/classes/Unit/ComposedUnit.src/M000107.html +22 -0
- data/doc/classes/Unit/ComposedUnit.src/M000108.html +25 -0
- data/doc/classes/Unit/ComposedUnit.src/M000109.html +25 -0
- data/doc/classes/Unit/ComposedUnit.src/M000110.html +22 -0
- data/doc/classes/Unit/ComposedUnit.src/M000111.html +29 -0
- data/doc/classes/Unit/ComposedUnit.src/M000112.html +24 -0
- data/doc/classes/Unit/ComposedUnit.src/M000113.html +25 -0
- data/doc/classes/Unit/ComposedUnit.src/M000114.html +18 -0
- data/doc/classes/Unit/Optimizer.html +152 -0
- data/doc/classes/Unit/Optimizer.src/M000042.html +44 -0
- data/doc/classes/Unit/Optimizer.src/M000043.html +18 -0
- data/doc/classes/Unit/Optimizer.src/M000105.html +44 -0
- data/doc/classes/Unit/Optimizer.src/M000106.html +18 -0
- data/doc/classes/Unit/Parser.html +176 -0
- data/doc/classes/Unit/Parser.src/M000039.html +18 -0
- data/doc/classes/Unit/Parser.src/M000040.html +25 -0
- data/doc/classes/Unit/Parser.src/M000041.html +19 -0
- data/doc/classes/Unit/Parser.src/M000102.html +18 -0
- data/doc/classes/Unit/Parser.src/M000103.html +25 -0
- data/doc/classes/Unit/Parser.src/M000104.html +19 -0
- data/doc/classes/Unit/SimpleUnit.html +287 -0
- data/doc/classes/Unit/SimpleUnit.src/M000032.html +20 -0
- data/doc/classes/Unit/SimpleUnit.src/M000033.html +20 -0
- data/doc/classes/Unit/SimpleUnit.src/M000034.html +20 -0
- data/doc/classes/Unit/SimpleUnit.src/M000035.html +20 -0
- data/doc/classes/Unit/SimpleUnit.src/M000036.html +18 -0
- data/doc/classes/Unit/SimpleUnit.src/M000037.html +21 -0
- data/doc/classes/Unit/SimpleUnit.src/M000038.html +18 -0
- data/doc/classes/Unit/SimpleUnit.src/M000094.html +20 -0
- data/doc/classes/Unit/SimpleUnit.src/M000095.html +20 -0
- data/doc/classes/Unit/SimpleUnit.src/M000096.html +20 -0
- data/doc/classes/Unit/SimpleUnit.src/M000097.html +20 -0
- data/doc/classes/Unit/SimpleUnit.src/M000098.html +18 -0
- data/doc/classes/Unit/SimpleUnit.src/M000099.html +21 -0
- data/doc/classes/Unit/SimpleUnit.src/M000100.html +18 -0
- data/doc/classes/Unit/SymbolConverter.html +131 -0
- data/doc/classes/Unit/SymbolConverter.src/M000029.html +24 -0
- data/doc/classes/Unit/SymbolConverter.src/M000091.html +24 -0
- data/doc/classes/Unit/TestCase.html +146 -0
- data/doc/classes/Unit/TestCase.src/M000101.html +24 -0
- data/doc/classes/Unit.html +120 -0
- data/doc/classes/UnitOptemizerTest.html +249 -0
- data/doc/classes/UnitOptemizerTest.src/M000011.html +31 -0
- data/doc/classes/UnitOptemizerTest.src/M000012.html +25 -0
- data/doc/classes/UnitOptemizerTest.src/M000013.html +27 -0
- data/doc/classes/UnitOptemizerTest.src/M000014.html +27 -0
- data/doc/classes/UnitOptemizerTest.src/M000015.html +27 -0
- data/doc/classes/UnitOptemizerTest.src/M000016.html +26 -0
- data/doc/classes/UnitOptemizerTest.src/M000017.html +23 -0
- data/doc/classes/UnitOptemizerTest.src/M000018.html +22 -0
- data/doc/created.rid +1 -0
- data/doc/files/config/default_configuration_rb.html +108 -0
- data/doc/files/quantity_rb.html +113 -0
- data/doc/files/test/all_tests_rb.html +108 -0
- data/doc/files/test/test_helper_rb.html +110 -0
- data/doc/files/test/unit/calculator_test_rb.html +109 -0
- data/doc/files/test/unit/composed_unit_test_rb.html +101 -0
- data/doc/files/test/unit/configuration_test_rb.html +109 -0
- data/doc/files/test/unit/custom_conversion_test_rb.html +109 -0
- data/doc/files/test/unit/quantifiable_test_rb.html +101 -0
- data/doc/files/test/unit/quantity_test_rb.html +101 -0
- data/doc/files/test/unit/simple_unit_test_rb.html +101 -0
- data/doc/files/test/unit/unit_optimizer_test_rb.html +101 -0
- data/doc/files/test/unit/unit_spec_parser_test_rb.html +101 -0
- data/doc/files/unitmanager/calculator_rb.html +101 -0
- data/doc/files/unitmanager/configuration_rb.html +101 -0
- data/doc/files/unitmanager/quantity_rb.html +101 -0
- data/doc/files/unitmanager/simple_unit_rb.html +108 -0
- data/doc/files/unitmanager/unit_composition_rb.html +101 -0
- data/doc/fr_class_index.html +44 -0
- data/doc/fr_file_index.html +33 -0
- data/doc/fr_method_index.html +77 -0
- data/doc/index.html +24 -0
- data/lib/config/default_configuration.rb +115 -0
- data/lib/quantity.rb +34 -0
- data/lib/unitmanager/calculator.rb +195 -0
- data/lib/unitmanager/configuration.rb +26 -0
- data/lib/unitmanager/quantity.rb +167 -0
- data/lib/unitmanager/simple_unit.rb +155 -0
- data/lib/unitmanager/unit_composition.rb +217 -0
- data/test/all_tests.rb +8 -0
- data/test/calculator_test.rb +194 -0
- data/test/composed_unit_test.rb +169 -0
- data/test/configuration_test.rb +70 -0
- data/test/custom_conversion_test.rb +90 -0
- data/test/quantifiable_test.rb +73 -0
- data/test/quantity_test.rb +79 -0
- data/test/simple_unit_test.rb +59 -0
- data/test/test_helper.rb +18 -0
- data/test/unit_optimizer_test.rb +104 -0
- data/test/unit_spec_parser_test.rb +50 -0
- metadata +307 -0
@@ -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>parse_operand_symbols (Unit::Parser)</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 unitmanager/unit_composition.rb, line 182</span>
|
14
|
+
182: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_operand_symbols</span>(<span class="ruby-identifier">string</span>)
|
15
|
+
183: <span class="ruby-identifier">operands</span> = <span class="ruby-identifier">string</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span>[] <span class="ruby-operator">:</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\*/</span>)
|
16
|
+
184: <span class="ruby-identifier">operands</span>.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>}
|
17
|
+
185: <span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</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>new (Unit::Parser)</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 unitmanager/unit_composition.rb, line 167</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">units</span>)
|
15
|
+
<span class="ruby-ivar">@units</span> = <span class="ruby-identifier">units</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</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_units (Unit::Parser)</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 unitmanager/unit_composition.rb, line 171</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_units</span>(<span class="ruby-identifier">unit_spec</span>)
|
15
|
+
|
16
|
+
<span class="ruby-identifier">operands</span> = <span class="ruby-identifier">unit_spec</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\//</span>)
|
17
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-node">"Invalid Number of Operands in : #{unit_spec}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">operands</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">2</span>
|
18
|
+
|
19
|
+
{
|
20
|
+
<span class="ruby-identifier">:dividends</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">parse_operand_symbols</span>(<span class="ruby-identifier">operands</span>[<span class="ruby-value">0</span>])),
|
21
|
+
<span class="ruby-identifier">:divisors</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">parse_operand_symbols</span>(<span class="ruby-identifier">operands</span>[<span class="ruby-value">1</span>]))
|
22
|
+
}
|
23
|
+
<span class="ruby-keyword kw">end</span></pre>
|
24
|
+
</body>
|
25
|
+
</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>parse_operand_symbols (Unit::Parser)</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 unitmanager/unit_composition.rb, line 182</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_operand_symbols</span>(<span class="ruby-identifier">string</span>)
|
15
|
+
<span class="ruby-identifier">operands</span> = <span class="ruby-identifier">string</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span>[] <span class="ruby-operator">:</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\*/</span>)
|
16
|
+
<span class="ruby-identifier">operands</span>.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>}
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,287 @@
|
|
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: Unit::SimpleUnit</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">Unit::SimpleUnit</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/unitmanager/simple_unit_rb.html">
|
59
|
+
unitmanager/simple_unit.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
|
+
Object
|
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
|
+
Implementation of what is called ‘simple unit of measure’. This is a
|
84
|
+
linear unit which is optionally based on some other simple unit with linear
|
85
|
+
coefficient. Example: :cm is based on :mm with coefficient equal 10. In
|
86
|
+
other words X cm = 10 * Y mm.
|
87
|
+
</p>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
|
94
|
+
<div id="method-list">
|
95
|
+
<h3 class="section-bar">Methods</h3>
|
96
|
+
|
97
|
+
<div class="name-list">
|
98
|
+
<a href="#M000037">==</a>
|
99
|
+
<a href="#M000035">[]</a>
|
100
|
+
<a href="#M000038">eql?</a>
|
101
|
+
<a href="#M000034">from_base</a>
|
102
|
+
<a href="#M000036">h_base</a>
|
103
|
+
<a href="#M000032">new</a>
|
104
|
+
<a href="#M000033">to_base</a>
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
<!-- if includes -->
|
112
|
+
<div id="includes">
|
113
|
+
<h3 class="section-bar">Included Modules</h3>
|
114
|
+
|
115
|
+
<div id="includes-list">
|
116
|
+
<span class="include-name"><a href="Comparable.html">Unit::Comparable</a></span>
|
117
|
+
</div>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div id="section">
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
<div id="attribute-list">
|
127
|
+
<h3 class="section-bar">Attributes</h3>
|
128
|
+
|
129
|
+
<div class="name-list">
|
130
|
+
<table>
|
131
|
+
<tr class="top-aligned-row context-row">
|
132
|
+
<td class="context-item-name">based_on</td>
|
133
|
+
<td class="context-item-value"> [R] </td>
|
134
|
+
<td class="context-item-desc"></td>
|
135
|
+
</tr>
|
136
|
+
<tr class="top-aligned-row context-row">
|
137
|
+
<td class="context-item-name">coefficient</td>
|
138
|
+
<td class="context-item-value"> [R] </td>
|
139
|
+
<td class="context-item-desc"></td>
|
140
|
+
</tr>
|
141
|
+
<tr class="top-aligned-row context-row">
|
142
|
+
<td class="context-item-name">unit</td>
|
143
|
+
<td class="context-item-value"> [R] </td>
|
144
|
+
<td class="context-item-desc"></td>
|
145
|
+
</tr>
|
146
|
+
</table>
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<!-- if method_list -->
|
153
|
+
<div id="methods">
|
154
|
+
<h3 class="section-bar">Public Class methods</h3>
|
155
|
+
|
156
|
+
<div id="method-M000032" class="method-detail">
|
157
|
+
<a name="M000032"></a>
|
158
|
+
|
159
|
+
<div class="method-heading">
|
160
|
+
<a href="SimpleUnit.src/M000032.html" target="Code" class="method-signature"
|
161
|
+
onclick="popupCode('SimpleUnit.src/M000032.html');return false;">
|
162
|
+
<span class="method-name">new</span><span class="method-args">(args)</span>
|
163
|
+
</a>
|
164
|
+
</div>
|
165
|
+
|
166
|
+
<div class="method-description">
|
167
|
+
</div>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
171
|
+
|
172
|
+
<div id="method-M000037" class="method-detail">
|
173
|
+
<a name="M000037"></a>
|
174
|
+
|
175
|
+
<div class="method-heading">
|
176
|
+
<a href="SimpleUnit.src/M000037.html" target="Code" class="method-signature"
|
177
|
+
onclick="popupCode('SimpleUnit.src/M000037.html');return false;">
|
178
|
+
<span class="method-name">==</span><span class="method-args">(other)</span>
|
179
|
+
</a>
|
180
|
+
</div>
|
181
|
+
|
182
|
+
<div class="method-description">
|
183
|
+
<p>
|
184
|
+
Two Simple units are equal if they have same symbol, based on the same unit
|
185
|
+
with the same coefficient
|
186
|
+
</p>
|
187
|
+
</div>
|
188
|
+
</div>
|
189
|
+
|
190
|
+
<div id="method-M000035" class="method-detail">
|
191
|
+
<a name="M000035"></a>
|
192
|
+
|
193
|
+
<div class="method-heading">
|
194
|
+
<a href="SimpleUnit.src/M000035.html" target="Code" class="method-signature"
|
195
|
+
onclick="popupCode('SimpleUnit.src/M000035.html');return false;">
|
196
|
+
<span class="method-name">[]</span><span class="method-args">(symbol)</span>
|
197
|
+
</a>
|
198
|
+
</div>
|
199
|
+
|
200
|
+
<div class="method-description">
|
201
|
+
<p>
|
202
|
+
This method allows to retrieve symbolic portions of the unit definition.
|
203
|
+
Supported values are:
|
204
|
+
</p>
|
205
|
+
<pre>
|
206
|
+
:dividends - returns an array of symbols representing dividend part of
|
207
|
+
unit definition.
|
208
|
+
:divisors - returns an array of symbols representing divisor part of
|
209
|
+
unit definition.
|
210
|
+
:string - string representation of the unit of measure.
|
211
|
+
</pre>
|
212
|
+
</div>
|
213
|
+
</div>
|
214
|
+
|
215
|
+
<div id="method-M000038" class="method-detail">
|
216
|
+
<a name="M000038"></a>
|
217
|
+
|
218
|
+
<div class="method-heading">
|
219
|
+
<a href="SimpleUnit.src/M000038.html" target="Code" class="method-signature"
|
220
|
+
onclick="popupCode('SimpleUnit.src/M000038.html');return false;">
|
221
|
+
<span class="method-name">eql?</span><span class="method-args">(other)</span>
|
222
|
+
</a>
|
223
|
+
</div>
|
224
|
+
|
225
|
+
<div class="method-description">
|
226
|
+
</div>
|
227
|
+
</div>
|
228
|
+
|
229
|
+
<div id="method-M000034" class="method-detail">
|
230
|
+
<a name="M000034"></a>
|
231
|
+
|
232
|
+
<div class="method-heading">
|
233
|
+
<a href="SimpleUnit.src/M000034.html" target="Code" class="method-signature"
|
234
|
+
onclick="popupCode('SimpleUnit.src/M000034.html');return false;">
|
235
|
+
<span class="method-name">from_base</span><span class="method-args">(value)</span>
|
236
|
+
</a>
|
237
|
+
</div>
|
238
|
+
|
239
|
+
<div class="method-description">
|
240
|
+
</div>
|
241
|
+
</div>
|
242
|
+
|
243
|
+
<div id="method-M000036" class="method-detail">
|
244
|
+
<a name="M000036"></a>
|
245
|
+
|
246
|
+
<div class="method-heading">
|
247
|
+
<a href="SimpleUnit.src/M000036.html" target="Code" class="method-signature"
|
248
|
+
onclick="popupCode('SimpleUnit.src/M000036.html');return false;">
|
249
|
+
<span class="method-name">h_base</span><span class="method-args">()</span>
|
250
|
+
</a>
|
251
|
+
</div>
|
252
|
+
|
253
|
+
<div class="method-description">
|
254
|
+
<p>
|
255
|
+
Returns unit representing hierarchy base for the given unit. The Hierarchy
|
256
|
+
is the "based on" chain.
|
257
|
+
</p>
|
258
|
+
</div>
|
259
|
+
</div>
|
260
|
+
|
261
|
+
<div id="method-M000033" class="method-detail">
|
262
|
+
<a name="M000033"></a>
|
263
|
+
|
264
|
+
<div class="method-heading">
|
265
|
+
<a href="SimpleUnit.src/M000033.html" target="Code" class="method-signature"
|
266
|
+
onclick="popupCode('SimpleUnit.src/M000033.html');return false;">
|
267
|
+
<span class="method-name">to_base</span><span class="method-args">(value)</span>
|
268
|
+
</a>
|
269
|
+
</div>
|
270
|
+
|
271
|
+
<div class="method-description">
|
272
|
+
</div>
|
273
|
+
</div>
|
274
|
+
|
275
|
+
|
276
|
+
</div>
|
277
|
+
|
278
|
+
|
279
|
+
</div>
|
280
|
+
|
281
|
+
|
282
|
+
<div id="validator-badges">
|
283
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
284
|
+
</div>
|
285
|
+
|
286
|
+
</body>
|
287
|
+
</html>
|
@@ -0,0 +1,20 @@
|
|
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 (Unit::SimpleUnit)</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 unitmanager/simple_unit.rb, line 55</span>
|
14
|
+
55: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> (<span class="ruby-identifier">args</span>)
|
15
|
+
56: <span class="ruby-ivar">@unit</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:unit</span>]
|
16
|
+
57: <span class="ruby-ivar">@based_on</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:based_on</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">nil</span>
|
17
|
+
58: <span class="ruby-ivar">@coefficient</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:coefficient</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1</span>
|
18
|
+
59: <span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,20 @@
|
|
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_base (Unit::SimpleUnit)</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 unitmanager/simple_unit.rb, line 61</span>
|
14
|
+
61: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_base</span>(<span class="ruby-identifier">value</span>)
|
15
|
+
62: <span class="ruby-identifier">value</span> = <span class="ruby-ivar">@based_on</span>.<span class="ruby-identifier">to_base</span>(<span class="ruby-identifier">value</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">derived?</span>
|
16
|
+
63:
|
17
|
+
64: <span class="ruby-identifier">value</span> <span class="ruby-operator">*=</span> <span class="ruby-ivar">@coefficient</span>
|
18
|
+
65: <span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,20 @@
|
|
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>from_base (Unit::SimpleUnit)</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 unitmanager/simple_unit.rb, line 67</span>
|
14
|
+
67: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">from_base</span>(<span class="ruby-identifier">value</span>)
|
15
|
+
68: <span class="ruby-identifier">value</span> = <span class="ruby-ivar">@based_on</span>.<span class="ruby-identifier">from_base</span>(<span class="ruby-identifier">value</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">derived?</span>
|
16
|
+
69:
|
17
|
+
70: <span class="ruby-identifier">value</span> <span class="ruby-operator">/=</span> <span class="ruby-ivar">@coefficient</span>
|
18
|
+
71: <span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,20 @@
|
|
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>[] (Unit::SimpleUnit)</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 unitmanager/simple_unit.rb, line 80</span>
|
14
|
+
80: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span> (<span class="ruby-identifier">symbol</span>)
|
15
|
+
81: <span class="ruby-ivar">@unit_sym</span> = {<span class="ruby-identifier">:dividends</span> =<span class="ruby-operator">></span> [<span class="ruby-ivar">@unit</span>], <span class="ruby-identifier">:divisors</span> =<span class="ruby-operator">></span> [], <span class="ruby-identifier">:string</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@unit</span>.<span class="ruby-identifier">to_s</span>} <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@unit_sym</span>
|
16
|
+
82:
|
17
|
+
83: <span class="ruby-ivar">@unit_sym</span>[<span class="ruby-identifier">symbol</span>]
|
18
|
+
84: <span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</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>h_base (Unit::SimpleUnit)</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 unitmanager/simple_unit.rb, line 88</span>
|
14
|
+
88: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">h_base</span>
|
15
|
+
89: <span class="ruby-identifier">derived?</span> <span class="ruby-value">? </span><span class="ruby-ivar">@based_on</span>.<span class="ruby-identifier">h_base</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>
|
16
|
+
90: <span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</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>== (Unit::SimpleUnit)</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 unitmanager/simple_unit.rb, line 94</span>
|
14
|
+
94: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">other</span>)
|
15
|
+
95: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
16
|
+
96: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>)
|
17
|
+
97:
|
18
|
+
98: <span class="ruby-identifier">unit</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">unit</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">based_on</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">based_on</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">coefficient</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">coefficient</span>
|
19
|
+
99: <span class="ruby-keyword kw">end</span></pre>
|
20
|
+
</body>
|
21
|
+
</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>eql? (Unit::SimpleUnit)</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 unitmanager/simple_unit.rb, line 101</span>
|
14
|
+
101: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">other</span>)
|
15
|
+
102: <span class="ruby-keyword kw">self</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>
|
16
|
+
103: <span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,20 @@
|
|
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 (Unit::SimpleUnit)</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 unitmanager/simple_unit.rb, line 55</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> (<span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-ivar">@unit</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:unit</span>]
|
16
|
+
<span class="ruby-ivar">@based_on</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:based_on</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">nil</span>
|
17
|
+
<span class="ruby-ivar">@coefficient</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:coefficient</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1</span>
|
18
|
+
<span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,20 @@
|
|
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_base (Unit::SimpleUnit)</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 unitmanager/simple_unit.rb, line 61</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_base</span>(<span class="ruby-identifier">value</span>)
|
15
|
+
<span class="ruby-identifier">value</span> = <span class="ruby-ivar">@based_on</span>.<span class="ruby-identifier">to_base</span>(<span class="ruby-identifier">value</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">derived?</span>
|
16
|
+
|
17
|
+
<span class="ruby-identifier">value</span> <span class="ruby-operator">*=</span> <span class="ruby-ivar">@coefficient</span>
|
18
|
+
<span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,20 @@
|
|
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>from_base (Unit::SimpleUnit)</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 unitmanager/simple_unit.rb, line 67</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">from_base</span>(<span class="ruby-identifier">value</span>)
|
15
|
+
<span class="ruby-identifier">value</span> = <span class="ruby-ivar">@based_on</span>.<span class="ruby-identifier">from_base</span>(<span class="ruby-identifier">value</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">derived?</span>
|
16
|
+
|
17
|
+
<span class="ruby-identifier">value</span> <span class="ruby-operator">/=</span> <span class="ruby-ivar">@coefficient</span>
|
18
|
+
<span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,20 @@
|
|
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>[] (Unit::SimpleUnit)</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 unitmanager/simple_unit.rb, line 80</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span> (<span class="ruby-identifier">symbol</span>)
|
15
|
+
<span class="ruby-ivar">@unit_sym</span> = {<span class="ruby-identifier">:dividends</span> =<span class="ruby-operator">></span> [<span class="ruby-ivar">@unit</span>], <span class="ruby-identifier">:divisors</span> =<span class="ruby-operator">></span> [], <span class="ruby-identifier">:string</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@unit</span>.<span class="ruby-identifier">to_s</span>} <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@unit_sym</span>
|
16
|
+
|
17
|
+
<span class="ruby-ivar">@unit_sym</span>[<span class="ruby-identifier">symbol</span>]
|
18
|
+
<span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</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>h_base (Unit::SimpleUnit)</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 unitmanager/simple_unit.rb, line 88</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">h_base</span>
|
15
|
+
<span class="ruby-identifier">derived?</span> <span class="ruby-value">? </span><span class="ruby-ivar">@based_on</span>.<span class="ruby-identifier">h_base</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|