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.
- data/gem_package.rb +4 -4
- data/html/classes/Eymiha/AmbiguousUnitsException.html +119 -0
- data/html/classes/Eymiha/MissingUnitsException.html +119 -0
- data/html/classes/Eymiha/NumericWithUnits.html +867 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000021.html +18 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000022.html +18 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000023.html +18 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000024.html +30 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000025.html +30 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000027.html +18 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000028.html +20 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000029.html +32 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000030.html +18 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000031.html +30 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000032.html +30 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000033.html +22 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000034.html +22 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000035.html +32 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000036.html +32 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000037.html +18 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000038.html +18 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000039.html +24 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000040.html +26 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000041.html +18 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000042.html +18 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000043.html +18 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000044.html +20 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000045.html +18 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000046.html +25 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000047.html +18 -0
- data/html/classes/Eymiha/NumericWithUnits.src/M000048.html +19 -0
- data/html/classes/Eymiha/Units.html +378 -0
- data/html/classes/Eymiha/Units.src/M000052.html +18 -0
- data/html/classes/Eymiha/Units.src/M000053.html +18 -0
- data/html/classes/Eymiha/Units.src/M000054.html +20 -0
- data/html/classes/Eymiha/Units.src/M000055.html +30 -0
- data/html/classes/Eymiha/Units.src/M000056.html +33 -0
- data/html/classes/Eymiha/Units.src/M000057.html +18 -0
- data/html/classes/Eymiha/Units.src/M000058.html +21 -0
- data/html/classes/Eymiha/Units.src/M000059.html +18 -0
- data/html/classes/Eymiha/Units.src/M000060.html +18 -0
- data/html/classes/Eymiha/Units.src/M000061.html +18 -0
- data/html/classes/Eymiha/Units.src/M000062.html +18 -0
- data/html/classes/Eymiha/Units.src/M000063.html +18 -0
- data/html/classes/Eymiha/Units.src/M000064.html +28 -0
- data/html/classes/Eymiha/UnitsException.html +119 -0
- data/html/classes/Eymiha/UnitsHash.html +351 -0
- data/html/classes/Eymiha/UnitsHash.src/M000002.html +18 -0
- data/html/classes/Eymiha/UnitsHash.src/M000003.html +26 -0
- data/html/classes/Eymiha/UnitsHash.src/M000004.html +25 -0
- data/html/classes/Eymiha/UnitsHash.src/M000005.html +18 -0
- data/html/classes/Eymiha/UnitsHash.src/M000006.html +18 -0
- data/html/classes/Eymiha/UnitsHash.src/M000007.html +18 -0
- data/html/classes/Eymiha/UnitsHash.src/M000008.html +22 -0
- data/html/classes/Eymiha/UnitsHash.src/M000010.html +21 -0
- data/html/classes/Eymiha/UnitsHash.src/M000011.html +19 -0
- data/html/classes/Eymiha/UnitsHash.src/M000012.html +27 -0
- data/html/classes/Eymiha/UnitsHash.src/M000013.html +18 -0
- data/html/classes/Eymiha/UnitsMeasure.html +302 -0
- data/html/classes/Eymiha/UnitsMeasure.src/M000014.html +23 -0
- data/html/classes/Eymiha/UnitsMeasure.src/M000015.html +18 -0
- data/html/classes/Eymiha/UnitsMeasure.src/M000016.html +18 -0
- data/html/classes/Eymiha/UnitsMeasure.src/M000017.html +18 -0
- data/html/classes/Eymiha/UnitsMeasure.src/M000018.html +18 -0
- data/html/classes/Eymiha/UnitsMeasure.src/M000019.html +18 -0
- data/html/classes/Eymiha/UnitsMeasure.src/M000020.html +18 -0
- data/html/classes/Eymiha/UnitsSystem.html +196 -0
- data/html/classes/Eymiha/UnitsSystem.src/M000050.html +31 -0
- data/html/classes/Eymiha/UnitsSystem.src/M000051.html +18 -0
- data/html/classes/Eymiha/UnitsUnit.html +166 -0
- data/html/classes/Eymiha/UnitsUnit.src/M000049.html +18 -0
- data/html/classes/Eymiha.html +143 -0
- data/html/classes/Numeric.html +182 -0
- data/html/classes/Numeric.src/M000001.html +50 -0
- data/html/created.rid +1 -0
- data/html/files/lib/eymiha/units/definitions/area_rb.html +101 -0
- data/html/files/lib/eymiha/units/definitions/length_rb.html +101 -0
- data/html/files/lib/eymiha/units/definitions/mass_rb.html +101 -0
- data/html/files/lib/eymiha/units/definitions/measures_rb.html +113 -0
- data/html/files/lib/eymiha/units/definitions/time_rb.html +101 -0
- data/html/files/lib/eymiha/units/definitions/velocity_rb.html +101 -0
- data/html/files/lib/eymiha/units/definitions/volume_rb.html +101 -0
- data/html/files/lib/eymiha/units/numeric_rb.html +116 -0
- data/html/files/lib/eymiha/units/numeric_with_units_rb.html +109 -0
- data/html/files/lib/eymiha/units/object_rb.html +108 -0
- data/html/files/lib/eymiha/units/units_exception_rb.html +101 -0
- data/html/files/lib/eymiha/units/units_hash_rb.html +108 -0
- data/html/files/lib/eymiha/units/units_measure_rb.html +109 -0
- data/html/files/lib/eymiha/units/units_rb.html +115 -0
- data/html/files/lib/eymiha/units/units_system_rb.html +109 -0
- data/html/files/lib/eymiha/units/units_unit_rb.html +109 -0
- data/html/files/lib/eymiha/units_rb.html +115 -0
- data/html/fr_class_index.html +37 -0
- data/html/fr_file_index.html +43 -0
- data/html/fr_method_index.html +90 -0
- data/html/index.html +24 -0
- data/html/rdoc-style.css +208 -0
- data/lib/{units → eymiha/units}/definitions/area.rb +0 -0
- data/lib/{units → eymiha/units}/definitions/length.rb +0 -0
- data/lib/{units → eymiha/units}/definitions/mass.rb +0 -0
- data/lib/eymiha/units/definitions/measures.rb +6 -0
- data/lib/{units → eymiha/units}/definitions/time.rb +0 -0
- data/lib/{units → eymiha/units}/definitions/velocity.rb +0 -0
- data/lib/{units → eymiha/units}/definitions/volume.rb +0 -0
- data/lib/{units → eymiha/units}/numeric.rb +4 -3
- data/lib/eymiha/units/numeric_with_units.rb +640 -0
- data/lib/{units → eymiha/units}/object.rb +1 -1
- data/lib/eymiha/units/units.rb +234 -0
- data/lib/eymiha/units/units_exception.rb +18 -0
- data/lib/eymiha/units/units_hash.rb +118 -0
- data/lib/eymiha/units/units_measure.rb +95 -0
- data/lib/eymiha/units/units_system.rb +89 -0
- data/lib/eymiha/units/units_unit.rb +63 -0
- data/lib/eymiha/units.rb +4 -0
- data/test/tc_definitions.rb +1 -1
- data/test/tc_formatting.rb +2 -2
- data/test/tc_formatting_derived.rb +2 -2
- data/test/tc_measure_create.rb +2 -2
- data/test/tc_measure_derive.rb +2 -2
- data/test/tc_system_create.rb +2 -2
- data/test/tc_unit_ambiguity.rb +2 -2
- data/test/tc_unit_arithmetic.rb +2 -2
- data/test/tc_unit_create.rb +2 -2
- data/test/tc_unit_derive.rb +2 -2
- data/test/tc_unit_equality.rb +2 -2
- data/test/tc_unit_forward_reference.rb +2 -2
- data/test/tc_unit_greek.rb +2 -2
- data/test/tc_unit_hash.rb +2 -2
- data/test/tc_unit_identifiers.rb +2 -2
- data/test/tc_unit_rank.rb +2 -2
- data/test/tc_uses_1.rb +2 -2
- data/test/tc_uses_2.rb +2 -2
- metadata +190 -86
- data/lib/units/definitions/measures.rb +0 -6
- data/lib/units/numeric_with_units.rb +0 -635
- data/lib/units/units.rb +0 -229
- data/lib/units/units_exception.rb +0 -14
- data/lib/units/units_hash.rb +0 -112
- data/lib/units/units_measure.rb +0 -91
- data/lib/units/units_system.rb +0 -85
- data/lib/units/units_unit.rb +0 -60
- data/lib/units.rb +0 -4
@@ -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>convert! (Eymiha::NumericWithUnits)</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/numeric_with_units.rb, line 596</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert!</span>(<span class="ruby-identifier">target_units</span>=<span class="ruby-keyword kw">nil</span>)
|
15
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">target_units</span>)
|
16
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">numeric</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unit</span> = <span class="ruby-identifier">result</span>.<span class="ruby-identifier">numeric</span>, <span class="ruby-identifier">result</span>.<span class="ruby-identifier">unit</span>
|
17
|
+
<span class="ruby-keyword kw">self</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>measure (Eymiha::NumericWithUnits)</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/numeric_with_units.rb, line 603</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">measure</span>
|
15
|
+
<span class="ruby-identifier">unit</span>.<span class="ruby-identifier">measure</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>format (Eymiha::NumericWithUnits)</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/numeric_with_units.rb, line 611</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">format</span>(<span class="ruby-identifier">name</span>=<span class="ruby-keyword kw">nil</span>)
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
16
|
+
<span class="ruby-identifier">to_s</span>
|
17
|
+
<span class="ruby-keyword kw">else</span>
|
18
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">UnitsException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"system not explicit"</span>) <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">measure</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>)
|
19
|
+
<span class="ruby-identifier">format</span> = <span class="ruby-identifier">measure</span>.<span class="ruby-identifier">formats</span>[<span class="ruby-identifier">name</span>]
|
20
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">UnitsException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"missing format"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">format</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
21
|
+
<span class="ruby-identifier">format</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword kw">self</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>derived? (Eymiha::NumericWithUnits)</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/numeric_with_units.rb, line 624</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">derived?</span>
|
15
|
+
<span class="ruby-identifier">unit</span>.<span class="ruby-identifier">derived?</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</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>reduce (Eymiha::NumericWithUnits)</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/numeric_with_units.rb, line 630</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">"reduce unit.reduce #{unit.reduce}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@debug</span>
|
16
|
+
<span class="ruby-identifier">numeric</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">unit</span>.<span class="ruby-identifier">reduce</span>
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,378 @@
|
|
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::Units</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::Units</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_rb.html">
|
59
|
+
lib/eymiha/units/units.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
|
+
The <a href="Units.html">Units</a> framework
|
84
|
+
</p>
|
85
|
+
<p>
|
86
|
+
<a href="Units.html">Units</a> is the top level that you‘ll typically
|
87
|
+
never have to deal with directly. While it provides a few chunks of general
|
88
|
+
functionality such as getting defined units and ranking, most of its guts
|
89
|
+
are devoted to defining new UnitsMeasures - unless you‘re setting up
|
90
|
+
your own sets of specialized units, you will hardly know it‘s here.
|
91
|
+
</p>
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
<div id="method-list">
|
99
|
+
<h3 class="section-bar">Methods</h3>
|
100
|
+
|
101
|
+
<div class="name-list">
|
102
|
+
<a href="#M000060">[]</a>
|
103
|
+
<a href="#M000058">clear</a>
|
104
|
+
<a href="#M000054">create</a>
|
105
|
+
<a href="#M000052">debug=</a>
|
106
|
+
<a href="#M000063">defining?</a>
|
107
|
+
<a href="#M000057">delete</a>
|
108
|
+
<a href="#M000055">derive</a>
|
109
|
+
<a href="#M000056">find_by_derivation</a>
|
110
|
+
<a href="#M000062">lookup</a>
|
111
|
+
<a href="#M000061">names_of</a>
|
112
|
+
<a href="#M000064">rank</a>
|
113
|
+
<a href="#M000059">size</a>
|
114
|
+
<a href="#M000053">units_measures</a>
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
|
121
|
+
<!-- if includes -->
|
122
|
+
|
123
|
+
<div id="section">
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
<!-- if method_list -->
|
133
|
+
<div id="methods">
|
134
|
+
<h3 class="section-bar">Public Class methods</h3>
|
135
|
+
|
136
|
+
<div id="method-M000060" class="method-detail">
|
137
|
+
<a name="M000060"></a>
|
138
|
+
|
139
|
+
<div class="method-heading">
|
140
|
+
<a href="Units.src/M000060.html" target="Code" class="method-signature"
|
141
|
+
onclick="popupCode('Units.src/M000060.html');return false;">
|
142
|
+
<span class="method-name">[]</span><span class="method-args">(name)</span>
|
143
|
+
</a>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div class="method-description">
|
147
|
+
<p>
|
148
|
+
Returns the named <a href="UnitsMeasure.html">UnitsMeasure</a>.
|
149
|
+
</p>
|
150
|
+
</div>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
<div id="method-M000058" class="method-detail">
|
154
|
+
<a name="M000058"></a>
|
155
|
+
|
156
|
+
<div class="method-heading">
|
157
|
+
<a href="Units.src/M000058.html" target="Code" class="method-signature"
|
158
|
+
onclick="popupCode('Units.src/M000058.html');return false;">
|
159
|
+
<span class="method-name">clear</span><span class="method-args">()</span>
|
160
|
+
</a>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<div class="method-description">
|
164
|
+
<p>
|
165
|
+
Clears the <a href="Units.html">Units</a> framework of all defined
|
166
|
+
elements.
|
167
|
+
</p>
|
168
|
+
</div>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<div id="method-M000054" class="method-detail">
|
172
|
+
<a name="M000054"></a>
|
173
|
+
|
174
|
+
<div class="method-heading">
|
175
|
+
<a href="Units.src/M000054.html" target="Code" class="method-signature"
|
176
|
+
onclick="popupCode('Units.src/M000054.html');return false;">
|
177
|
+
<span class="method-name">create</span><span class="method-args">(name, &block)</span>
|
178
|
+
</a>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
<div class="method-description">
|
182
|
+
<p>
|
183
|
+
Creates or extends a <a href="UnitsMeasure.html">UnitsMeasure</a>.
|
184
|
+
</p>
|
185
|
+
</div>
|
186
|
+
</div>
|
187
|
+
|
188
|
+
<div id="method-M000052" class="method-detail">
|
189
|
+
<a name="M000052"></a>
|
190
|
+
|
191
|
+
<div class="method-heading">
|
192
|
+
<a href="Units.src/M000052.html" target="Code" class="method-signature"
|
193
|
+
onclick="popupCode('Units.src/M000052.html');return false;">
|
194
|
+
<span class="method-name">debug=</span><span class="method-args">(value)</span>
|
195
|
+
</a>
|
196
|
+
</div>
|
197
|
+
|
198
|
+
<div class="method-description">
|
199
|
+
</div>
|
200
|
+
</div>
|
201
|
+
|
202
|
+
<div id="method-M000063" class="method-detail">
|
203
|
+
<a name="M000063"></a>
|
204
|
+
|
205
|
+
<div class="method-heading">
|
206
|
+
<a href="Units.src/M000063.html" target="Code" class="method-signature"
|
207
|
+
onclick="popupCode('Units.src/M000063.html');return false;">
|
208
|
+
<span class="method-name">defining?</span><span class="method-args">()</span>
|
209
|
+
</a>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
<div class="method-description">
|
213
|
+
<p>
|
214
|
+
Answers the question of whether a <a
|
215
|
+
href="UnitsMeasure.html">UnitsMeasure</a> is being defined with the
|
216
|
+
instance if true, or nil if false.
|
217
|
+
</p>
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
<div id="method-M000057" class="method-detail">
|
222
|
+
<a name="M000057"></a>
|
223
|
+
|
224
|
+
<div class="method-heading">
|
225
|
+
<a href="Units.src/M000057.html" target="Code" class="method-signature"
|
226
|
+
onclick="popupCode('Units.src/M000057.html');return false;">
|
227
|
+
<span class="method-name">delete</span><span class="method-args">(name)</span>
|
228
|
+
</a>
|
229
|
+
</div>
|
230
|
+
|
231
|
+
<div class="method-description">
|
232
|
+
<p>
|
233
|
+
Removes the named <a href="UnitsMeasure.html">UnitsMeasure</a> from the <a
|
234
|
+
href="Units.html">Units</a> framework.
|
235
|
+
</p>
|
236
|
+
</div>
|
237
|
+
</div>
|
238
|
+
|
239
|
+
<div id="method-M000055" class="method-detail">
|
240
|
+
<a name="M000055"></a>
|
241
|
+
|
242
|
+
<div class="method-heading">
|
243
|
+
<a href="Units.src/M000055.html" target="Code" class="method-signature"
|
244
|
+
onclick="popupCode('Units.src/M000055.html');return false;">
|
245
|
+
<span class="method-name">derive</span><span class="method-args">(name, target, &block)</span>
|
246
|
+
</a>
|
247
|
+
</div>
|
248
|
+
|
249
|
+
<div class="method-description">
|
250
|
+
<p>
|
251
|
+
Creates or extends a <a href="UnitsMeasure.html">UnitsMeasure</a> derived
|
252
|
+
from other UnitsMeasures.
|
253
|
+
</p>
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
|
257
|
+
<div id="method-M000056" class="method-detail">
|
258
|
+
<a name="M000056"></a>
|
259
|
+
|
260
|
+
<div class="method-heading">
|
261
|
+
<a href="Units.src/M000056.html" target="Code" class="method-signature"
|
262
|
+
onclick="popupCode('Units.src/M000056.html');return false;">
|
263
|
+
<span class="method-name">find_by_derivation</span><span class="method-args">(derivation)</span>
|
264
|
+
</a>
|
265
|
+
</div>
|
266
|
+
|
267
|
+
<div class="method-description">
|
268
|
+
<p>
|
269
|
+
Returns the <a href="UnitsMeasure.html">UnitsMeasure</a> with the given
|
270
|
+
derivation.
|
271
|
+
</p>
|
272
|
+
</div>
|
273
|
+
</div>
|
274
|
+
|
275
|
+
<div id="method-M000062" class="method-detail">
|
276
|
+
<a name="M000062"></a>
|
277
|
+
|
278
|
+
<div class="method-heading">
|
279
|
+
<a href="Units.src/M000062.html" target="Code" class="method-signature"
|
280
|
+
onclick="popupCode('Units.src/M000062.html');return false;">
|
281
|
+
<span class="method-name">lookup</span><span class="method-args">(unit_identifier)</span>
|
282
|
+
</a>
|
283
|
+
</div>
|
284
|
+
|
285
|
+
<div class="method-description">
|
286
|
+
<p>
|
287
|
+
Returns an Array of <a href="UnitsUnit.html">UnitsUnit</a> associated with
|
288
|
+
a singular, plural or abbreviated name.
|
289
|
+
</p>
|
290
|
+
</div>
|
291
|
+
</div>
|
292
|
+
|
293
|
+
<div id="method-M000061" class="method-detail">
|
294
|
+
<a name="M000061"></a>
|
295
|
+
|
296
|
+
<div class="method-heading">
|
297
|
+
<a href="Units.src/M000061.html" target="Code" class="method-signature"
|
298
|
+
onclick="popupCode('Units.src/M000061.html');return false;">
|
299
|
+
<span class="method-name">names_of</span><span class="method-args">(units_measure)</span>
|
300
|
+
</a>
|
301
|
+
</div>
|
302
|
+
|
303
|
+
<div class="method-description">
|
304
|
+
<p>
|
305
|
+
Returns an Array containing the names of a given <a
|
306
|
+
href="UnitsMeasure.html">UnitsMeasure</a>.
|
307
|
+
</p>
|
308
|
+
</div>
|
309
|
+
</div>
|
310
|
+
|
311
|
+
<div id="method-M000064" class="method-detail">
|
312
|
+
<a name="M000064"></a>
|
313
|
+
|
314
|
+
<div class="method-heading">
|
315
|
+
<a href="Units.src/M000064.html" target="Code" class="method-signature"
|
316
|
+
onclick="popupCode('Units.src/M000064.html');return false;">
|
317
|
+
<span class="method-name">rank</span><span class="method-args">(unit_choices = {},samples = []) {|n| ...}</span>
|
318
|
+
</a>
|
319
|
+
</div>
|
320
|
+
|
321
|
+
<div class="method-description">
|
322
|
+
<p>
|
323
|
+
Given a Hash of units to raking weights, a set of samples, and optionally a
|
324
|
+
block that returns rankings, returns an Array of units ordered by best
|
325
|
+
weighted fit over the samples. Like golf, low scores <a
|
326
|
+
href="Units.html#M000064">rank</a> best. In absence of a block, ranking is
|
327
|
+
based on the number of unit values whose magnitudes are between 1 and 10.
|
328
|
+
</p>
|
329
|
+
</div>
|
330
|
+
</div>
|
331
|
+
|
332
|
+
<div id="method-M000059" class="method-detail">
|
333
|
+
<a name="M000059"></a>
|
334
|
+
|
335
|
+
<div class="method-heading">
|
336
|
+
<a href="Units.src/M000059.html" target="Code" class="method-signature"
|
337
|
+
onclick="popupCode('Units.src/M000059.html');return false;">
|
338
|
+
<span class="method-name">size</span><span class="method-args">()</span>
|
339
|
+
</a>
|
340
|
+
</div>
|
341
|
+
|
342
|
+
<div class="method-description">
|
343
|
+
<p>
|
344
|
+
Returns the number of defined UnitsMeasures.
|
345
|
+
</p>
|
346
|
+
</div>
|
347
|
+
</div>
|
348
|
+
|
349
|
+
<div id="method-M000053" class="method-detail">
|
350
|
+
<a name="M000053"></a>
|
351
|
+
|
352
|
+
<div class="method-heading">
|
353
|
+
<a href="Units.src/M000053.html" target="Code" class="method-signature"
|
354
|
+
onclick="popupCode('Units.src/M000053.html');return false;">
|
355
|
+
<span class="method-name">units_measures</span><span class="method-args">()</span>
|
356
|
+
</a>
|
357
|
+
</div>
|
358
|
+
|
359
|
+
<div class="method-description">
|
360
|
+
<p>
|
361
|
+
Returns an Array of the defined UnitsMeasures.
|
362
|
+
</p>
|
363
|
+
</div>
|
364
|
+
</div>
|
365
|
+
|
366
|
+
|
367
|
+
</div>
|
368
|
+
|
369
|
+
|
370
|
+
</div>
|
371
|
+
|
372
|
+
|
373
|
+
<div id="validator-badges">
|
374
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
375
|
+
</div>
|
376
|
+
|
377
|
+
</body>
|
378
|
+
</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>debug= (Eymiha::Units)</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.rb, line 25</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">debug=</span>(<span class="ruby-identifier">value</span>)
|
15
|
+
<span class="ruby-ivar">@@debug</span> = <span class="ruby-identifier">value</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>units_measures (Eymiha::Units)</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.rb, line 38</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Units</span>.<span class="ruby-identifier">units_measures</span>
|
15
|
+
<span class="ruby-ivar">@@measures</span>.<span class="ruby-identifier">keys</span>
|
16
|
+
<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>create (Eymiha::Units)</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.rb, line 43</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Units</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
15
|
+
<span class="ruby-identifier">measure</span> = (<span class="ruby-ivar">@@measures</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">UnitsMeasure</span>.<span class="ruby-identifier">new</span>)
|
16
|
+
<span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">measure</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
17
|
+
<span class="ruby-identifier">measure</span>
|
18
|
+
<span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
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>derive (Eymiha::Units)</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.rb, line 50</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Units</span>.<span class="ruby-identifier">derive</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">target</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
15
|
+
<span class="ruby-identifier">measure</span> = ( <span class="ruby-ivar">@@measures</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>] =
|
16
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">target</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">UnitsMeasure</span>
|
17
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">target</span>.<span class="ruby-identifier">derived</span> <span class="ruby-operator">&&</span>
|
18
|
+
(<span class="ruby-identifier">derived</span> = <span class="ruby-identifier">find_by_derivation</span> <span class="ruby-identifier">target</span>.<span class="ruby-identifier">derived</span>)
|
19
|
+
<span class="ruby-identifier">derived</span>
|
20
|
+
<span class="ruby-keyword kw">else</span>
|
21
|
+
<span class="ruby-identifier">target</span>
|
22
|
+
<span class="ruby-keyword kw">end</span>
|
23
|
+
<span class="ruby-keyword kw">else</span>
|
24
|
+
<span class="ruby-constant">Units</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">target</span>.<span class="ruby-identifier">to_s</span>)
|
25
|
+
<span class="ruby-keyword kw">end</span> )
|
26
|
+
<span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">measure</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
27
|
+
<span class="ruby-identifier">measure</span>
|
28
|
+
<span class="ruby-keyword kw">end</span></pre>
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,33 @@
|
|
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>find_by_derivation (Eymiha::Units)</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.rb, line 67</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Units</span>.<span class="ruby-identifier">find_by_derivation</span>(<span class="ruby-identifier">derivation</span>)
|
15
|
+
<span class="ruby-identifier">matches</span> = <span class="ruby-ivar">@@measures</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">measure</span><span class="ruby-operator">|</span>
|
16
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">measure</span>.<span class="ruby-identifier">derived</span>
|
17
|
+
<span class="ruby-identifier">measure</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">derivation</span>
|
18
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">derivation</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
19
|
+
<span class="ruby-identifier">a</span> = <span class="ruby-identifier">derivation</span>.<span class="ruby-identifier">to_a</span>[<span class="ruby-value">0</span>]
|
20
|
+
<span class="ruby-identifier">a</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">measure</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">a</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
21
|
+
<span class="ruby-keyword kw">else</span>
|
22
|
+
<span class="ruby-keyword kw">false</span>
|
23
|
+
<span class="ruby-keyword kw">end</span>
|
24
|
+
}
|
25
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">matches</span>.<span class="ruby-identifier">size</span>
|
26
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">nil</span>
|
27
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">matches</span>[<span class="ruby-value">0</span>]
|
28
|
+
<span class="ruby-keyword kw">else</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">UnitsException</span>,
|
29
|
+
<span class="ruby-value str">"Multiple UnitsMeasures with same derivation found"</span>
|
30
|
+
<span class="ruby-keyword kw">end</span>
|
31
|
+
<span class="ruby-keyword kw">end</span></pre>
|
32
|
+
</body>
|
33
|
+
</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>delete (Eymiha::Units)</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.rb, line 87</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Units</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">name</span>)
|
15
|
+
<span class="ruby-ivar">@@measures</span>.<span class="ruby-identifier">delete</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|