temperature 1.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,159 @@
1
+ body {
2
+ background-color: #8DBD82;
3
+ font-family: "Georgia", sans-serif;
4
+ font-size: 16px;
5
+ line-height: 1.6em;
6
+ padding: 1.6em 0 0 0;
7
+ color: #333;
8
+ }
9
+ h1, h2, h3, h4, h5, h6 {
10
+ color: #444;
11
+ }
12
+ h1 {
13
+ font-family: sans-serif;
14
+ font-weight: normal;
15
+ font-size: 4em;
16
+ line-height: 0.8em;
17
+ letter-spacing: -0.1ex;
18
+ margin: 5px;
19
+ }
20
+ li {
21
+ padding: 0;
22
+ margin: 0;
23
+ list-style-type: square;
24
+ }
25
+ a {
26
+ color: #5E5AFF;
27
+ background-color: #A1DDB1;
28
+ font-weight: normal;
29
+ text-decoration: underline;
30
+ }
31
+ blockquote {
32
+ font-size: 90%;
33
+ font-style: italic;
34
+ border-left: 1px solid #111;
35
+ padding-left: 1em;
36
+ }
37
+ .caps {
38
+ font-size: 80%;
39
+ }
40
+
41
+ #main {
42
+ width: 55em;
43
+ padding: 0;
44
+ margin: 0 auto;
45
+ }
46
+ .coda {
47
+ text-align: right;
48
+ color: #77f;
49
+ font-size: smaller;
50
+ }
51
+
52
+ table {
53
+ font-size: 90%;
54
+ line-height: 1.4em;
55
+ color: #ff8;
56
+ background-color: #111;
57
+ padding: 2px 10px 2px 10px;
58
+ border-style: dashed;
59
+ }
60
+
61
+ th {
62
+ color: #fff;
63
+ }
64
+
65
+ td {
66
+ padding: 2px 10px 2px 10px;
67
+ }
68
+
69
+ .success {
70
+ color: #0CC52B;
71
+ }
72
+
73
+ .failed {
74
+ color: #E90A1B;
75
+ }
76
+
77
+ .unknown {
78
+ color: #995000;
79
+ }
80
+ pre, code {
81
+ font-family: monospace;
82
+ font-size: 90%;
83
+ line-height: 1.4em;
84
+ color: #ff8;
85
+ background-color: #111;
86
+ width: 40em;
87
+ padding: 2px 10px 2px 10px;
88
+ }
89
+ .comment { color: #aaa; font-style: italic; }
90
+ .keyword { color: #eff; font-weight: bold; }
91
+ .punct { color: #eee; font-weight: bold; }
92
+ .symbol { color: #0bb; }
93
+ .string { color: #6b4; }
94
+ .ident { color: #ff8; }
95
+ .constant { color: #66f; }
96
+ .regex { color: #ec6; }
97
+ .number { color: #F99; }
98
+ .expr { color: #227; }
99
+
100
+ .sidebar {
101
+ float: right;
102
+ }
103
+
104
+ #version {
105
+ width: 217px;
106
+ text-align: right;
107
+ font-family: sans-serif;
108
+ font-weight: normal;
109
+ color: #141331;
110
+ padding: 15px 20px 10px 20px;
111
+ margin: 0 auto;
112
+ margin-top: 15px;
113
+ background-color: #9A5535;
114
+ border: 3px solid #7E393E;
115
+ }
116
+
117
+ #version .numbers {
118
+ display: block;
119
+ font-size: 4em;
120
+ line-height: 0.8em;
121
+ letter-spacing: -0.1ex;
122
+ margin-bottom: 15px;
123
+ }
124
+
125
+ #version p {
126
+ text-decoration: none;
127
+ color: #F1F4FF;
128
+ background-color: #9A5535;
129
+ margin: 0;
130
+ padding: 0;
131
+ }
132
+
133
+ #version a {
134
+ text-decoration: none;
135
+ color: #F1F4FF;
136
+ background-color: #9A5535;
137
+ }
138
+
139
+ .clickable {
140
+ cursor: pointer;
141
+ cursor: hand;
142
+ }
143
+
144
+ #twitter_search {
145
+ margin: 40px 0 10px 15px;
146
+ color: #F1F4FF;
147
+ background-color: #9A5535;
148
+ border: 3px solid #7E393E;
149
+ }
150
+
151
+ #twitter_search h3 {
152
+ color: #F1F4FF;
153
+ margin-bottom: 0px;
154
+ }
155
+
156
+ #twitter_search center b {
157
+ display: none;
158
+ }
159
+
@@ -0,0 +1,50 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
+ <title>
8
+ <%= title %>
9
+ </title>
10
+ <script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
11
+ <style>
12
+
13
+ </style>
14
+ <script type="text/javascript">
15
+ window.onload = function() {
16
+ settings = {
17
+ tl: { radius: 10 },
18
+ tr: { radius: 10 },
19
+ bl: { radius: 10 },
20
+ br: { radius: 10 },
21
+ antiAlias: true,
22
+ autoPad: true,
23
+ validTags: ["div"]
24
+ }
25
+ var versionBox = new curvyCorners(settings, document.getElementById("version"));
26
+ versionBox.applyCornersToAll();
27
+ }
28
+ </script>
29
+ </head>
30
+ <body>
31
+ <div id="main">
32
+
33
+ <h1><%= title %></h1>
34
+ <div class="sidebar">
35
+ <div id="version" class="clickable" onclick='document.location = "<%= download %>"; return false'>
36
+ <p>Get Version</p>
37
+ <a href="<%= download %>" class="numbers"><%= version %></a>
38
+ </div>
39
+ </div>
40
+ <%= body %>
41
+ <p class="coda">
42
+ <a href="FIXME email">FIXME full name</a>, <%= modified.pretty %><br>
43
+ Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
44
+ </p>
45
+ </div>
46
+
47
+ <!-- insert site tracking codes here, like Google Urchin -->
48
+
49
+ </body>
50
+ </html>
metadata CHANGED
@@ -1,56 +1,98 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: temperature
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.0"
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Dague
8
- autorequire: temperature
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-05 00:00:00 -05:00
12
+ date: 2010-03-09 00:00:00 -05:00
13
13
  default_executable:
14
- dependencies: []
15
-
16
- description: ""
17
- email: sean@dague.net
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rubyforge
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.0.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: gemcutter
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.0
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: hoe
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 2.5.0
44
+ version:
45
+ description: |-
46
+ Temperature makes it easy to deal with temperatures in Ruby, but
47
+ adding mixin methods to numbers and strings.
48
+
49
+ This was inspired by using Ruby to manipulate data from my home
50
+ weather station, and wanting it to keep track of the units for me so
51
+ that I didn't have to think about that in code.
52
+ email:
53
+ - sean@dague.net
18
54
  executables: []
19
55
 
20
56
  extensions: []
21
57
 
22
58
  extra_rdoc_files:
23
- - README
24
- - COPYING
59
+ - History.txt
60
+ - Manifest.txt
61
+ - PostInstall.txt
62
+ - website/index.txt
25
63
  files:
26
- - test/num_test.rb
27
- - test/dewpoint_test.rb
28
- - test/coverage/lib-temperature_rb.html
29
- - test/coverage/index.html
30
- - test/convert_test.rb
31
- - lib/temperature.rb
32
- - docs/temperature/files/lib/temperature_rb.html
33
- - docs/temperature/files/README.html
34
- - docs/temperature/files/COPYING.html
35
- - docs/temperature/index.html
36
- - docs/temperature/fr_method_index.html
37
- - docs/temperature/created.rid
38
- - docs/temperature/fr_class_index.html
39
- - docs/temperature/classes/String.html
40
- - docs/temperature/classes/Numeric.html
41
- - docs/temperature/rdoc-style.css
42
- - docs/temperature/fr_file_index.html
43
- - Rakefile
44
- - README
45
64
  - COPYING
65
+ - History.txt
66
+ - Manifest.txt
67
+ - PostInstall.txt
68
+ - README.rdoc
69
+ - Rakefile
70
+ - config/website.yml
71
+ - lib/temperature.rb
72
+ - lib/temperature/numeric.rb
73
+ - lib/temperature/string.rb
74
+ - script/console
75
+ - script/destroy
76
+ - script/generate
77
+ - script/txt2html
78
+ - test/test_convert.rb
79
+ - test/test_dewpoint.rb
80
+ - test/test_helper.rb
81
+ - test/test_num.rb
82
+ - test/test_temperature.rb
83
+ - website/index.html
84
+ - website/index.txt
85
+ - website/javascripts/rounded_corners_lite.inc.js
86
+ - website/stylesheets/screen.css
87
+ - website/template.html.erb
46
88
  has_rdoc: true
47
89
  homepage: http://github.com/sdague/temperature.rb
48
90
  licenses: []
49
91
 
50
- post_install_message:
92
+ post_install_message: PostInstall.txt
51
93
  rdoc_options:
52
94
  - --main
53
- - README
95
+ - README.rdoc
54
96
  require_paths:
55
97
  - lib
56
98
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -67,10 +109,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
109
  version:
68
110
  requirements: []
69
111
 
70
- rubyforge_project:
112
+ rubyforge_project: sdaguegems
71
113
  rubygems_version: 1.3.5
72
114
  signing_key:
73
115
  specification_version: 3
74
- summary: A ruby mixin for making Numerics temperatures
75
- test_files: []
76
-
116
+ summary: Temperature makes it easy to deal with temperatures in Ruby, but adding mixin methods to numbers and strings
117
+ test_files:
118
+ - test/test_convert.rb
119
+ - test/test_num.rb
120
+ - test/test_temperature.rb
121
+ - test/test_dewpoint.rb
122
+ - test/test_helper.rb
data/README DELETED
@@ -1,45 +0,0 @@
1
- = Overview
2
-
3
- Temperature makes it easy to deal with temperatures in Ruby, but
4
- adding mixin methods to numbers and strings.
5
-
6
- This was inspired by using Ruby to manipulate data from my home
7
- weather station, and wanting it to keep track of the units for me so
8
- that I didn't have to think about that in code.
9
-
10
- == Example
11
-
12
- freezing_in_F = 32
13
- freezing_in_C = freezing_in_F.to_C
14
-
15
- boiling_in_C = 100
16
- boiling_in_C.units = "C"
17
- boiling_in_F = boiling_in_C.to_F
18
-
19
- absolute_zero = "0K".to_degrees
20
- absolute_zero_in_C = absolute_zero.to_C
21
- absolute_zero_in_F = absolute_zero.to_F
22
-
23
- There is also support to calculate dewpoint from relative humidity
24
- based on the NOAA approximation documented here -
25
- http://en.wikipedia.org/wiki/Dew_point#Closer_approximation
26
-
27
- dewpoint = 32.dewpoint(45)
28
-
29
- == Installation
30
-
31
- First install the gem
32
-
33
- gem install temperature
34
-
35
- Then include it in your environment
36
-
37
- require "temperature"
38
-
39
- == Authors
40
-
41
- Sean Dague <sean at dague dot net>
42
-
43
- == License
44
-
45
- This is released under an MIT license, see COPYING for full details.
@@ -1,619 +0,0 @@
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: Numeric</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">Numeric</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/temperature_rb.html">
59
- lib/temperature.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
- Temperature works as a mixin on both the <a href="Numeric.html">Numeric</a>
84
- and <a href="String.html">String</a> classes. The idea is to make
85
- manipulating temperatures as simple and natural as possible. If <a
86
- href="Numeric.html#M000001">units</a> are not specified, they are assume to
87
- be in degrees &#8216;F&#8217;. Yes, I realize this is US centric, but
88
- that&#8216;s where I live. In the future I&#8216;d like to auto detect that
89
- base on locale.
90
- </p>
91
- <p>
92
- Example use:
93
- </p>
94
- <pre>
95
- freezing_in_C = 32.to_C
96
-
97
- num = 0
98
- num.units = &quot;C&quot;
99
- freezing_in_F = num.to_F
100
- </pre>
101
-
102
- </div>
103
-
104
-
105
- </div>
106
-
107
- <div id="method-list">
108
- <h3 class="section-bar">Methods</h3>
109
-
110
- <div class="name-list">
111
- <a href="#M000009">c2f</a>&nbsp;&nbsp;
112
- <a href="#M000011">c2k</a>&nbsp;&nbsp;
113
- <a href="#M000015">dewpoint</a>&nbsp;&nbsp;
114
- <a href="#M000010">f2c</a>&nbsp;&nbsp;
115
- <a href="#M000013">f2k</a>&nbsp;&nbsp;
116
- <a href="#M000004">is_C?</a>&nbsp;&nbsp;
117
- <a href="#M000003">is_F?</a>&nbsp;&nbsp;
118
- <a href="#M000005">is_K?</a>&nbsp;&nbsp;
119
- <a href="#M000012">k2c</a>&nbsp;&nbsp;
120
- <a href="#M000014">k2f</a>&nbsp;&nbsp;
121
- <a href="#M000007">to_C</a>&nbsp;&nbsp;
122
- <a href="#M000006">to_F</a>&nbsp;&nbsp;
123
- <a href="#M000008">to_K</a>&nbsp;&nbsp;
124
- <a href="#M000001">units</a>&nbsp;&nbsp;
125
- <a href="#M000002">units=</a>&nbsp;&nbsp;
126
- </div>
127
- </div>
128
-
129
- </div>
130
-
131
-
132
- <!-- if includes -->
133
-
134
- <div id="section">
135
-
136
-
137
- <div id="constants-list">
138
- <h3 class="section-bar">Constants</h3>
139
-
140
- <div class="name-list">
141
- <table summary="Constants">
142
- <tr class="top-aligned-row context-row">
143
- <td class="context-item-name">CScale</td>
144
- <td>=</td>
145
- <td class="context-item-value">1.8</td>
146
- <td width="3em">&nbsp;</td>
147
- <td class="context-item-desc">
148
- The scale factor between C and F
149
-
150
- </td>
151
- </tr>
152
- <tr class="top-aligned-row context-row">
153
- <td class="context-item-name">FOffset</td>
154
- <td>=</td>
155
- <td class="context-item-value">32</td>
156
- <td width="3em">&nbsp;</td>
157
- <td class="context-item-desc">
158
- The offset between C and F
159
-
160
- </td>
161
- </tr>
162
- <tr class="top-aligned-row context-row">
163
- <td class="context-item-name">KOffset</td>
164
- <td>=</td>
165
- <td class="context-item-value">273.15</td>
166
- <td width="3em">&nbsp;</td>
167
- <td class="context-item-desc">
168
- The offset between K and C
169
-
170
- </td>
171
- </tr>
172
- </table>
173
- </div>
174
- </div>
175
-
176
-
177
-
178
-
179
-
180
-
181
- <!-- if method_list -->
182
- <div id="methods">
183
- <h3 class="section-bar">Public Instance methods</h3>
184
-
185
- <div id="method-M000009" class="method-detail">
186
- <a name="M000009"></a>
187
-
188
- <div class="method-heading">
189
- <a href="#M000009" class="method-signature">
190
- <span class="method-name">c2f</span><span class="method-args">()</span>
191
- </a>
192
- </div>
193
-
194
- <div class="method-description">
195
- <p><a class="source-toggle" href="#"
196
- onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
197
- <div class="method-source-code" id="M000009-source">
198
- <pre>
199
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 98</span>
200
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">c2f</span>
201
- <span class="ruby-identifier">num</span> = <span class="ruby-keyword kw">self</span> <span class="ruby-operator">*</span> <span class="ruby-constant">CScale</span> <span class="ruby-operator">+</span> <span class="ruby-constant">FOffset</span>
202
- <span class="ruby-identifier">num</span>.<span class="ruby-identifier">units</span> = <span class="ruby-value str">&quot;F&quot;</span>
203
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">num</span>
204
- <span class="ruby-keyword kw">end</span>
205
- </pre>
206
- </div>
207
- </div>
208
- </div>
209
-
210
- <div id="method-M000011" class="method-detail">
211
- <a name="M000011"></a>
212
-
213
- <div class="method-heading">
214
- <a href="#M000011" class="method-signature">
215
- <span class="method-name">c2k</span><span class="method-args">()</span>
216
- </a>
217
- </div>
218
-
219
- <div class="method-description">
220
- <p><a class="source-toggle" href="#"
221
- onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
222
- <div class="method-source-code" id="M000011-source">
223
- <pre>
224
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 110</span>
225
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">c2k</span>
226
- <span class="ruby-identifier">num</span> = <span class="ruby-keyword kw">self</span> <span class="ruby-operator">+</span> <span class="ruby-constant">KOffset</span>
227
- <span class="ruby-identifier">num</span>.<span class="ruby-identifier">units</span> = <span class="ruby-value str">&quot;K&quot;</span>
228
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">num</span>
229
- <span class="ruby-keyword kw">end</span>
230
- </pre>
231
- </div>
232
- </div>
233
- </div>
234
-
235
- <div id="method-M000015" class="method-detail">
236
- <a name="M000015"></a>
237
-
238
- <div class="method-heading">
239
- <a href="#M000015" class="method-signature">
240
- <span class="method-name">dewpoint</span><span class="method-args">(rh)</span>
241
- </a>
242
- </div>
243
-
244
- <div class="method-description">
245
- <p>
246
- Compute the <a href="Numeric.html#M000015">dewpoint</a> for the temperature
247
- given a relative humidity. This is using the NOAA approximation for <a
248
- href="Numeric.html#M000015">dewpoint</a> calculation - <a
249
- href="http://en.wikipedia.org/wiki/Dew_point#Closer_approximation">en.wikipedia.org/wiki/Dew_point#Closer_approximation</a>
250
- </p>
251
- <p><a class="source-toggle" href="#"
252
- onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
253
- <div class="method-source-code" id="M000015-source">
254
- <pre>
255
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 134</span>
256
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dewpoint</span>(<span class="ruby-identifier">rh</span>)
257
- <span class="ruby-identifier">units</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">units</span>
258
- <span class="ruby-identifier">temp</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_C</span>
259
- <span class="ruby-identifier">e_sub_s</span> = <span class="ruby-value">6.112</span> <span class="ruby-operator">*</span> <span class="ruby-constant">Math</span>.<span class="ruby-identifier">exp</span>((<span class="ruby-value">17.76</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">temp</span>) <span class="ruby-operator">/</span> (<span class="ruby-identifier">temp</span> <span class="ruby-operator">+</span> <span class="ruby-value">243.5</span>))
260
- <span class="ruby-identifier">e</span> = <span class="ruby-identifier">rh</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">e_sub_s</span> <span class="ruby-operator">/</span> <span class="ruby-value">100</span>
261
- <span class="ruby-identifier">dew</span> = <span class="ruby-value">243.5</span> <span class="ruby-operator">*</span> <span class="ruby-constant">Math</span>.<span class="ruby-identifier">log</span>(<span class="ruby-identifier">e</span> <span class="ruby-operator">/</span> <span class="ruby-value">6.112</span>) <span class="ruby-operator">/</span> (<span class="ruby-value">17.67</span> <span class="ruby-operator">-</span> <span class="ruby-constant">Math</span>.<span class="ruby-identifier">log</span>(<span class="ruby-identifier">e</span> <span class="ruby-operator">/</span> <span class="ruby-value">6.112</span>))
262
- <span class="ruby-identifier">dew</span>.<span class="ruby-identifier">units</span> = <span class="ruby-value str">&quot;C&quot;</span>
263
- <span class="ruby-identifier">final</span> = <span class="ruby-identifier">dew</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;to_#{units}&quot;</span>)
264
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">final</span>
265
- <span class="ruby-keyword kw">end</span>
266
- </pre>
267
- </div>
268
- </div>
269
- </div>
270
-
271
- <div id="method-M000010" class="method-detail">
272
- <a name="M000010"></a>
273
-
274
- <div class="method-heading">
275
- <a href="#M000010" class="method-signature">
276
- <span class="method-name">f2c</span><span class="method-args">()</span>
277
- </a>
278
- </div>
279
-
280
- <div class="method-description">
281
- <p><a class="source-toggle" href="#"
282
- onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
283
- <div class="method-source-code" id="M000010-source">
284
- <pre>
285
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 104</span>
286
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">f2c</span>
287
- <span class="ruby-identifier">num</span> = (<span class="ruby-keyword kw">self</span> <span class="ruby-operator">-</span> <span class="ruby-constant">FOffset</span>) <span class="ruby-operator">/</span> <span class="ruby-constant">CScale</span>
288
- <span class="ruby-identifier">num</span>.<span class="ruby-identifier">units</span> = <span class="ruby-value str">&quot;C&quot;</span>
289
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">num</span>
290
- <span class="ruby-keyword kw">end</span>
291
- </pre>
292
- </div>
293
- </div>
294
- </div>
295
-
296
- <div id="method-M000013" class="method-detail">
297
- <a name="M000013"></a>
298
-
299
- <div class="method-heading">
300
- <a href="#M000013" class="method-signature">
301
- <span class="method-name">f2k</span><span class="method-args">()</span>
302
- </a>
303
- </div>
304
-
305
- <div class="method-description">
306
- <p><a class="source-toggle" href="#"
307
- onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
308
- <div class="method-source-code" id="M000013-source">
309
- <pre>
310
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 122</span>
311
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">f2k</span>
312
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">f2c</span>.<span class="ruby-identifier">c2k</span>
313
- <span class="ruby-keyword kw">end</span>
314
- </pre>
315
- </div>
316
- </div>
317
- </div>
318
-
319
- <div id="method-M000004" class="method-detail">
320
- <a name="M000004"></a>
321
-
322
- <div class="method-heading">
323
- <a href="#M000004" class="method-signature">
324
- <span class="method-name">is_C?</span><span class="method-args">()</span>
325
- </a>
326
- </div>
327
-
328
- <div class="method-description">
329
- <p>
330
- Is this a Celcius temperature, returns a boolean
331
- </p>
332
- <p><a class="source-toggle" href="#"
333
- onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
334
- <div class="method-source-code" id="M000004-source">
335
- <pre>
336
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 50</span>
337
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_C?</span>
338
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">units</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;C&quot;</span>
339
- <span class="ruby-keyword kw">end</span>
340
- </pre>
341
- </div>
342
- </div>
343
- </div>
344
-
345
- <div id="method-M000003" class="method-detail">
346
- <a name="M000003"></a>
347
-
348
- <div class="method-heading">
349
- <a href="#M000003" class="method-signature">
350
- <span class="method-name">is_F?</span><span class="method-args">()</span>
351
- </a>
352
- </div>
353
-
354
- <div class="method-description">
355
- <p>
356
- Is this a Farenheit temperature, returns a boolean
357
- </p>
358
- <p><a class="source-toggle" href="#"
359
- onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
360
- <div class="method-source-code" id="M000003-source">
361
- <pre>
362
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 45</span>
363
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_F?</span>
364
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">units</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;F&quot;</span>
365
- <span class="ruby-keyword kw">end</span>
366
- </pre>
367
- </div>
368
- </div>
369
- </div>
370
-
371
- <div id="method-M000005" class="method-detail">
372
- <a name="M000005"></a>
373
-
374
- <div class="method-heading">
375
- <a href="#M000005" class="method-signature">
376
- <span class="method-name">is_K?</span><span class="method-args">()</span>
377
- </a>
378
- </div>
379
-
380
- <div class="method-description">
381
- <p>
382
- Is this a Kelvin temperature, returns a boolean
383
- </p>
384
- <p><a class="source-toggle" href="#"
385
- onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
386
- <div class="method-source-code" id="M000005-source">
387
- <pre>
388
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 55</span>
389
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_K?</span>
390
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">units</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;K&quot;</span>
391
- <span class="ruby-keyword kw">end</span>
392
- </pre>
393
- </div>
394
- </div>
395
- </div>
396
-
397
- <div id="method-M000012" class="method-detail">
398
- <a name="M000012"></a>
399
-
400
- <div class="method-heading">
401
- <a href="#M000012" class="method-signature">
402
- <span class="method-name">k2c</span><span class="method-args">()</span>
403
- </a>
404
- </div>
405
-
406
- <div class="method-description">
407
- <p><a class="source-toggle" href="#"
408
- onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
409
- <div class="method-source-code" id="M000012-source">
410
- <pre>
411
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 116</span>
412
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">k2c</span>
413
- <span class="ruby-identifier">num</span> = <span class="ruby-keyword kw">self</span> <span class="ruby-operator">-</span> <span class="ruby-constant">KOffset</span>
414
- <span class="ruby-identifier">num</span>.<span class="ruby-identifier">units</span> = <span class="ruby-value str">&quot;C&quot;</span>
415
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">num</span>
416
- <span class="ruby-keyword kw">end</span>
417
- </pre>
418
- </div>
419
- </div>
420
- </div>
421
-
422
- <div id="method-M000014" class="method-detail">
423
- <a name="M000014"></a>
424
-
425
- <div class="method-heading">
426
- <a href="#M000014" class="method-signature">
427
- <span class="method-name">k2f</span><span class="method-args">()</span>
428
- </a>
429
- </div>
430
-
431
- <div class="method-description">
432
- <p><a class="source-toggle" href="#"
433
- onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
434
- <div class="method-source-code" id="M000014-source">
435
- <pre>
436
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 126</span>
437
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">k2f</span>
438
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">k2c</span>.<span class="ruby-identifier">c2f</span>
439
- <span class="ruby-keyword kw">end</span>
440
- </pre>
441
- </div>
442
- </div>
443
- </div>
444
-
445
- <div id="method-M000007" class="method-detail">
446
- <a name="M000007"></a>
447
-
448
- <div class="method-heading">
449
- <a href="#M000007" class="method-signature">
450
- <span class="method-name">to_C</span><span class="method-args">()</span>
451
- </a>
452
- </div>
453
-
454
- <div class="method-description">
455
- <p>
456
- Convert the temperature to Celcius. If it&#8216;s already in C, it returns
457
- itself.
458
- </p>
459
- <p><a class="source-toggle" href="#"
460
- onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
461
- <div class="method-source-code" id="M000007-source">
462
- <pre>
463
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 74</span>
464
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_C</span>
465
- <span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">units</span>
466
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;F&quot;</span><span class="ruby-operator">:</span>
467
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">f2c</span>
468
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;C&quot;</span><span class="ruby-operator">:</span>
469
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
470
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;K&quot;</span><span class="ruby-operator">:</span>
471
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">k2c</span>
472
- <span class="ruby-keyword kw">end</span>
473
- <span class="ruby-keyword kw">end</span>
474
- </pre>
475
- </div>
476
- </div>
477
- </div>
478
-
479
- <div id="method-M000006" class="method-detail">
480
- <a name="M000006"></a>
481
-
482
- <div class="method-heading">
483
- <a href="#M000006" class="method-signature">
484
- <span class="method-name">to_F</span><span class="method-args">()</span>
485
- </a>
486
- </div>
487
-
488
- <div class="method-description">
489
- <p>
490
- Convert the temperature to Farenheit. If it&#8216;s already in F, it
491
- returns itself.
492
- </p>
493
- <p><a class="source-toggle" href="#"
494
- onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
495
- <div class="method-source-code" id="M000006-source">
496
- <pre>
497
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 61</span>
498
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_F</span>
499
- <span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">units</span>
500
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;F&quot;</span><span class="ruby-operator">:</span>
501
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
502
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;C&quot;</span><span class="ruby-operator">:</span>
503
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">c2f</span>
504
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;K&quot;</span><span class="ruby-operator">:</span>
505
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">k2f</span>
506
- <span class="ruby-keyword kw">end</span>
507
- <span class="ruby-keyword kw">end</span>
508
- </pre>
509
- </div>
510
- </div>
511
- </div>
512
-
513
- <div id="method-M000008" class="method-detail">
514
- <a name="M000008"></a>
515
-
516
- <div class="method-heading">
517
- <a href="#M000008" class="method-signature">
518
- <span class="method-name">to_K</span><span class="method-args">()</span>
519
- </a>
520
- </div>
521
-
522
- <div class="method-description">
523
- <p>
524
- Convert the temperature to Kelvins. If it&#8216;s already in K, it returns
525
- itself.
526
- </p>
527
- <p><a class="source-toggle" href="#"
528
- onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
529
- <div class="method-source-code" id="M000008-source">
530
- <pre>
531
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 87</span>
532
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_K</span>
533
- <span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">units</span>
534
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;F&quot;</span><span class="ruby-operator">:</span>
535
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">f2k</span>
536
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;C&quot;</span><span class="ruby-operator">:</span>
537
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">c2k</span>
538
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;K&quot;</span><span class="ruby-operator">:</span>
539
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
540
- <span class="ruby-keyword kw">end</span>
541
- <span class="ruby-keyword kw">end</span>
542
- </pre>
543
- </div>
544
- </div>
545
- </div>
546
-
547
- <div id="method-M000001" class="method-detail">
548
- <a name="M000001"></a>
549
-
550
- <div class="method-heading">
551
- <a href="#M000001" class="method-signature">
552
- <span class="method-name">units</span><span class="method-args">()</span>
553
- </a>
554
- </div>
555
-
556
- <div class="method-description">
557
- <p>
558
- The degree <a href="Numeric.html#M000001">units</a> the temperature is in.
559
- This defaults to &quot;F&quot; if not specified. Valid values are
560
- &quot;C&quot;, &quot;F&quot;, or &quot;K&quot; (R is not currently
561
- support&#8230; no one really uses that anyway).
562
- </p>
563
- <p><a class="source-toggle" href="#"
564
- onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
565
- <div class="method-source-code" id="M000001-source">
566
- <pre>
567
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 28</span>
568
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">units</span>
569
- <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@units</span>
570
- <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@units</span>
571
- <span class="ruby-keyword kw">else</span>
572
- <span class="ruby-comment cmt"># this should auto detect the env, but for now, I live in the US</span>
573
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;F&quot;</span>
574
- <span class="ruby-keyword kw">end</span>
575
- <span class="ruby-keyword kw">end</span>
576
- </pre>
577
- </div>
578
- </div>
579
- </div>
580
-
581
- <div id="method-M000002" class="method-detail">
582
- <a name="M000002"></a>
583
-
584
- <div class="method-heading">
585
- <a href="#M000002" class="method-signature">
586
- <span class="method-name">units=</span><span class="method-args">(u)</span>
587
- </a>
588
- </div>
589
-
590
- <div class="method-description">
591
- <p><a class="source-toggle" href="#"
592
- onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
593
- <div class="method-source-code" id="M000002-source">
594
- <pre>
595
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 37</span>
596
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">units=</span>(<span class="ruby-identifier">u</span>)
597
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">u</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^(C|F|K)/</span>
598
- <span class="ruby-ivar">@units</span> = <span class="ruby-identifier">u</span>
599
- <span class="ruby-keyword kw">end</span>
600
- <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@units</span>
601
- <span class="ruby-keyword kw">end</span>
602
- </pre>
603
- </div>
604
- </div>
605
- </div>
606
-
607
-
608
- </div>
609
-
610
-
611
- </div>
612
-
613
-
614
- <div id="validator-badges">
615
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
616
- </div>
617
-
618
- </body>
619
- </html>