temperature 1.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,167 +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: String</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">String</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
-
82
-
83
- </div>
84
-
85
- <div id="method-list">
86
- <h3 class="section-bar">Methods</h3>
87
-
88
- <div class="name-list">
89
- <a href="#M000016">to_degrees</a>&nbsp;&nbsp;
90
- </div>
91
- </div>
92
-
93
- </div>
94
-
95
-
96
- <!-- if includes -->
97
-
98
- <div id="section">
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
- <!-- if method_list -->
108
- <div id="methods">
109
- <h3 class="section-bar">Public Instance methods</h3>
110
-
111
- <div id="method-M000016" class="method-detail">
112
- <a name="M000016"></a>
113
-
114
- <div class="method-heading">
115
- <a href="#M000016" class="method-signature">
116
- <span class="method-name">to_degrees</span><span class="method-args">()</span>
117
- </a>
118
- </div>
119
-
120
- <div class="method-description">
121
- <p>
122
- Parse a string that looks like a temperature into a temperature of the
123
- right units. It handles strings of the format
124
- </p>
125
- <pre>
126
- 35.1C
127
- 72K
128
- -40F
129
- </pre>
130
- <p>
131
- Decimals are support, as are negative numbers. The units must be C, K, or
132
- F, and not have a space between the numer and the units
133
- </p>
134
- <p><a class="source-toggle" href="#"
135
- onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
136
- <div class="method-source-code" id="M000016-source">
137
- <pre>
138
- <span class="ruby-comment cmt"># File lib/temperature.rb, line 160</span>
139
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_degrees</span>
140
- <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^(-?)(\d+)\.(\d+)(F|C|K)$/</span>
141
- <span class="ruby-identifier">tmp</span> = <span class="ruby-node">&quot;#{$1}#{$2}.#{$3}&quot;</span>.<span class="ruby-identifier">to_f</span>
142
- <span class="ruby-identifier">tmp</span>.<span class="ruby-identifier">units</span> = <span class="ruby-identifier">$4</span>
143
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">tmp</span>
144
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^(-?)(\d+)(F|C|K)$/</span>
145
- <span class="ruby-identifier">tmp</span> = <span class="ruby-node">&quot;#{$1}#{$2}&quot;</span>.<span class="ruby-identifier">to_f</span>
146
- <span class="ruby-identifier">tmp</span>.<span class="ruby-identifier">units</span> = <span class="ruby-identifier">$3</span>
147
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">tmp</span>
148
- <span class="ruby-keyword kw">end</span>
149
- <span class="ruby-keyword kw">end</span>
150
- </pre>
151
- </div>
152
- </div>
153
- </div>
154
-
155
-
156
- </div>
157
-
158
-
159
- </div>
160
-
161
-
162
- <div id="validator-badges">
163
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
164
- </div>
165
-
166
- </body>
167
- </html>
@@ -1 +0,0 @@
1
- Fri, 05 Mar 2010 19:00:49 -0500
@@ -1,133 +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>File: COPYING</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="fileHeader">
50
- <h1>COPYING</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>COPYING
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Fri Mar 05 18:57:07 -0500 2010</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
- <div id="description">
72
- <p>
73
- The MIT License
74
- </p>
75
- <p>
76
- Copyright (c) 2009 Sean Dague &lt;<a
77
- href="http://dague.net">dague.net</a>&gt;
78
- </p>
79
- <p>
80
- Permission is hereby granted, free of charge, to any person obtaining a
81
- copy of this software and associated documentation files (the
82
- &quot;Software&quot;), to deal in the Software without restriction,
83
- including without limitation the rights to use, copy, modify, merge,
84
- publish, distribute, sublicense, and/or sell copies of the Software, and to
85
- permit persons to whom the Software is furnished to do so, subject to the
86
- following conditions:
87
- </p>
88
- <p>
89
- The above copyright notice and this permission notice shall be included in
90
- all copies or substantial portions of the Software.
91
- </p>
92
- <p>
93
- THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
94
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
95
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
96
- NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
97
- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
98
- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
99
- USE OR OTHER DEALINGS IN THE SOFTWARE.
100
- </p>
101
-
102
- </div>
103
-
104
-
105
- </div>
106
-
107
-
108
- </div>
109
-
110
-
111
- <!-- if includes -->
112
-
113
- <div id="section">
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
- <!-- if method_list -->
123
-
124
-
125
- </div>
126
-
127
-
128
- <div id="validator-badges">
129
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
130
- </div>
131
-
132
- </body>
133
- </html>
@@ -1,156 +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>File: README</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="fileHeader">
50
- <h1>README</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>README
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Fri Mar 05 18:55:58 -0500 2010</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
- <div id="description">
72
- <h1>Overview</h1>
73
- <p>
74
- Temperature makes it easy to deal with temperatures in Ruby, but adding
75
- mixin methods to numbers and strings.
76
- </p>
77
- <p>
78
- This was inspired by using Ruby to manipulate data from my home weather
79
- station, and wanting it to keep track of the units for me so that I
80
- didn&#8216;t have to think about that in code.
81
- </p>
82
- <h2>Example</h2>
83
- <pre>
84
- freezing_in_F = 32
85
- freezing_in_C = freezing_in_F.to_C
86
-
87
- boiling_in_C = 100
88
- boiling_in_C.units = &quot;C&quot;
89
- boiling_in_F = boiling_in_C.to_F
90
-
91
- absolute_zero = &quot;0K&quot;.to_degrees
92
- absolute_zero_in_C = absolute_zero.to_C
93
- absolute_zero_in_F = absolute_zero.to_F
94
- </pre>
95
- <p>
96
- There is also support to calculate dewpoint from relative humidity based on
97
- the NOAA approximation documented here - <a
98
- href="http://en.wikipedia.org/wiki/Dew_point#Closer_approximation">en.wikipedia.org/wiki/Dew_point#Closer_approximation</a>
99
- </p>
100
- <pre>
101
- dewpoint = 32.dewpoint(45)
102
- </pre>
103
- <h2>Installation</h2>
104
- <p>
105
- First install the gem
106
- </p>
107
- <pre>
108
- gem install temperature
109
- </pre>
110
- <p>
111
- Then include it in your environment
112
- </p>
113
- <pre>
114
- require &quot;temperature&quot;
115
- </pre>
116
- <h2>Authors</h2>
117
- <p>
118
- Sean Dague &lt;sean at dague dot net&gt;
119
- </p>
120
- <h2>License</h2>
121
- <p>
122
- This is released under an MIT license, see COPYING for full details.
123
- </p>
124
-
125
- </div>
126
-
127
-
128
- </div>
129
-
130
-
131
- </div>
132
-
133
-
134
- <!-- if includes -->
135
-
136
- <div id="section">
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
- <!-- if method_list -->
146
-
147
-
148
- </div>
149
-
150
-
151
- <div id="validator-badges">
152
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
153
- </div>
154
-
155
- </body>
156
- </html>