smart_month 1.0.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.
Files changed (90) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README +33 -0
  3. data/Rakefile +51 -0
  4. data/VERSION +1 -0
  5. data/lib/month.rb +26 -0
  6. data/lib/smart_month.rb +11 -0
  7. data/lib/smart_month/calculations.rb +87 -0
  8. data/lib/smart_month/collection.rb +51 -0
  9. data/lib/smart_month/extensions/date.rb +19 -0
  10. data/lib/smart_month/magic.rb +71 -0
  11. data/lib/smart_month/math.rb +41 -0
  12. data/lib/smart_month/rulesets.rb +151 -0
  13. data/lib/smart_month/util.rb +37 -0
  14. data/pkg/smart_month-1.0.0.gem +0 -0
  15. data/rdoc/classes/Date.html +209 -0
  16. data/rdoc/classes/Month.html +189 -0
  17. data/rdoc/classes/SmartMonth.html +136 -0
  18. data/rdoc/classes/SmartMonth/Calculations.html +383 -0
  19. data/rdoc/classes/SmartMonth/Collection.html +306 -0
  20. data/rdoc/classes/SmartMonth/Magic.html +214 -0
  21. data/rdoc/classes/SmartMonth/Magic/MonthFactory.html +178 -0
  22. data/rdoc/classes/SmartMonth/Math.html +311 -0
  23. data/rdoc/classes/SmartMonth/Rulesets.html +419 -0
  24. data/rdoc/classes/SmartMonth/Util.html +302 -0
  25. data/rdoc/classes/Time.html +152 -0
  26. data/rdoc/created.rid +1 -0
  27. data/rdoc/files/README.html +170 -0
  28. data/rdoc/files/lib/month_rb.html +113 -0
  29. data/rdoc/files/lib/smart_month/calculations_rb.html +101 -0
  30. data/rdoc/files/lib/smart_month/collection_rb.html +101 -0
  31. data/rdoc/files/lib/smart_month/extensions/date_rb.html +108 -0
  32. data/rdoc/files/lib/smart_month/magic_rb.html +101 -0
  33. data/rdoc/files/lib/smart_month/math_rb.html +101 -0
  34. data/rdoc/files/lib/smart_month/rulesets_rb.html +108 -0
  35. data/rdoc/files/lib/smart_month/util_rb.html +101 -0
  36. data/rdoc/files/lib/smart_month_rb.html +108 -0
  37. data/rdoc/fr_class_index.html +37 -0
  38. data/rdoc/fr_file_index.html +36 -0
  39. data/rdoc/fr_method_index.html +74 -0
  40. data/rdoc/index.html +24 -0
  41. data/rdoc/rdoc-style.css +208 -0
  42. data/smart_month.gemspec +179 -0
  43. data/test/spec/date/accessor_spec.rb +91 -0
  44. data/test/spec/date/add_month_spec.rb +24 -0
  45. data/test/spec/date/add_spec.rb +23 -0
  46. data/test/spec/date/boat_spec.rb +20 -0
  47. data/test/spec/date/civil_spec.rb +28 -0
  48. data/test/spec/date/commercial_spec.rb +29 -0
  49. data/test/spec/date/constants_spec.rb +41 -0
  50. data/test/spec/date/conversions_spec.rb +153 -0
  51. data/test/spec/date/downto_spec.rb +18 -0
  52. data/test/spec/date/eql_spec.rb +10 -0
  53. data/test/spec/date/gregorian_spec.rb +28 -0
  54. data/test/spec/date/hash_spec.rb +14 -0
  55. data/test/spec/date/infinity_spec.rb +77 -0
  56. data/test/spec/date/julian_spec.rb +52 -0
  57. data/test/spec/date/minus_month_spec.rb +23 -0
  58. data/test/spec/date/minus_spec.rb +30 -0
  59. data/test/spec/date/new_spec.rb +9 -0
  60. data/test/spec/date/neww_spec.rb +9 -0
  61. data/test/spec/date/ordinal_spec.rb +29 -0
  62. data/test/spec/date/parse_spec.rb +149 -0
  63. data/test/spec/date/relationship_spec.rb +20 -0
  64. data/test/spec/date/shared/civil.rb +66 -0
  65. data/test/spec/date/shared/commercial.rb +39 -0
  66. data/test/spec/date/shared/parse.rb +54 -0
  67. data/test/spec/date/shared/parse_eu.rb +30 -0
  68. data/test/spec/date/shared/parse_us.rb +29 -0
  69. data/test/spec/date/step_spec.rb +56 -0
  70. data/test/spec/date/strftime_spec.rb +205 -0
  71. data/test/spec/date/strptime_spec.rb +143 -0
  72. data/test/spec/date/upto_spec.rb +18 -0
  73. data/test/spec/parsedate/parsedate.rb +95 -0
  74. data/test/spec/time/httpdate_spec.rb +21 -0
  75. data/test/spec/time/iso8601_spec.rb +7 -0
  76. data/test/spec/time/rfc2822_spec.rb +7 -0
  77. data/test/spec/time/rfc822_spec.rb +7 -0
  78. data/test/spec/time/shared/rfc2822.rb +65 -0
  79. data/test/spec/time/shared/xmlschema.rb +53 -0
  80. data/test/spec/time/xmlschema_spec.rb +7 -0
  81. data/test/spec_helper.rb +56 -0
  82. data/test/test_helper.rb +4 -0
  83. data/test/unit/calculations_test.rb +82 -0
  84. data/test/unit/collection_test.rb +42 -0
  85. data/test/unit/magic_test.rb +37 -0
  86. data/test/unit/math_test.rb +30 -0
  87. data/test/unit/rulesets_test.rb +94 -0
  88. data/test/unit/samples/test_ruleset.yml +6 -0
  89. data/test/unit/util_test.rb +29 -0
  90. metadata +196 -0
@@ -0,0 +1,214 @@
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>Module: SmartMonth::Magic</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>Module</strong></td>
53
+ <td class="class-name-in-header">SmartMonth::Magic</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/smart_month/magic_rb.html">
59
+ lib/smart_month/magic.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <p>
77
+ <a href="Magic.html">Magic</a> is responsible for the rails-like dynamic
78
+ &quot;magic finders&quot;.
79
+ </p>
80
+
81
+ </div>
82
+
83
+
84
+ </div>
85
+
86
+ <div id="method-list">
87
+ <h3 class="section-bar">Methods</h3>
88
+
89
+ <div class="name-list">
90
+ <a href="#M000013">included</a>&nbsp;&nbsp;
91
+ <a href="#M000014">method_missing</a>&nbsp;&nbsp;
92
+ </div>
93
+ </div>
94
+
95
+ </div>
96
+
97
+
98
+ <!-- if includes -->
99
+
100
+ <div id="section">
101
+
102
+ <div id="class-list">
103
+ <h3 class="section-bar">Classes and Modules</h3>
104
+
105
+ Module <a href="Magic/MonthFactory.html" class="link">SmartMonth::Magic::MonthFactory</a><br />
106
+
107
+ </div>
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ <!-- if method_list -->
116
+ <div id="methods">
117
+ <h3 class="section-bar">Public Class methods</h3>
118
+
119
+ <div id="method-M000013" class="method-detail">
120
+ <a name="M000013"></a>
121
+
122
+ <div class="method-heading">
123
+ <a href="#M000013" class="method-signature">
124
+ <span class="method-name">included</span><span class="method-args">(base)</span>
125
+ </a>
126
+ </div>
127
+
128
+ <div class="method-description">
129
+ <p>
130
+ extends the <a href="../Month.html">Month</a> class with the <a
131
+ href="../Month.html">Month</a> factory
132
+ </p>
133
+ <p><a class="source-toggle" href="#"
134
+ onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
135
+ <div class="method-source-code" id="M000013-source">
136
+ <pre>
137
+ <span class="ruby-comment cmt"># File lib/smart_month/magic.rb, line 6</span>
138
+ 6: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
139
+ 7: <span class="ruby-identifier">base</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">MonthFactory</span>
140
+ 8: <span class="ruby-keyword kw">end</span>
141
+ </pre>
142
+ </div>
143
+ </div>
144
+ </div>
145
+
146
+ <h3 class="section-bar">Public Instance methods</h3>
147
+
148
+ <div id="method-M000014" class="method-detail">
149
+ <a name="M000014"></a>
150
+
151
+ <div class="method-heading">
152
+ <a href="#M000014" class="method-signature">
153
+ <span class="method-name">method_missing</span><span class="method-args">(meth)</span>
154
+ </a>
155
+ </div>
156
+
157
+ <div class="method-description">
158
+ <p>
159
+ nice catchall to allow rails-esque APIs if you choose to.
160
+ </p>
161
+ <p><a class="source-toggle" href="#"
162
+ onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
163
+ <div class="method-source-code" id="M000014-source">
164
+ <pre>
165
+ <span class="ruby-comment cmt"># File lib/smart_month/magic.rb, line 24</span>
166
+ 24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">meth</span>)
167
+ 25: <span class="ruby-identifier">raw</span> = <span class="ruby-identifier">meth</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;_&quot;</span>)
168
+ 26:
169
+ 27: <span class="ruby-comment cmt"># execute lookup using week as positioning control</span>
170
+ 28: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">week_position?</span>(<span class="ruby-identifier">raw</span>[<span class="ruby-value">0</span>]) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">raw</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;and&quot;</span>
171
+ 29: <span class="ruby-identifier">results</span> = []
172
+ 30: <span class="ruby-comment cmt"># parse the request</span>
173
+ 31: <span class="ruby-identifier">arg</span> = <span class="ruby-identifier">raw</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-identifier">raw</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">raw</span>.<span class="ruby-identifier">last</span>))
174
+ 32: <span class="ruby-identifier">funcs</span> = <span class="ruby-identifier">parse_arguments</span>(<span class="ruby-identifier">raw</span>)
175
+ 33: <span class="ruby-comment cmt"># execute</span>
176
+ 34: <span class="ruby-identifier">funcs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">func</span><span class="ruby-operator">|</span>
177
+ 35: <span class="ruby-identifier">results</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">func</span>,<span class="ruby-identifier">arg</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">week_position?</span>(<span class="ruby-identifier">func</span>)
178
+ 36: <span class="ruby-keyword kw">end</span>
179
+ 37: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">results</span>
180
+ 38:
181
+ 39: <span class="ruby-comment cmt"># execute an every pattern on n-days</span>
182
+ 40: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">raw</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;every&quot;</span>
183
+ 41: <span class="ruby-comment cmt"># parse the request</span>
184
+ 42: <span class="ruby-identifier">func</span> = <span class="ruby-identifier">raw</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>)
185
+ 43: <span class="ruby-identifier">args</span> = <span class="ruby-identifier">parse_arguments</span>(<span class="ruby-identifier">raw</span>)
186
+ 44: <span class="ruby-comment cmt"># execute</span>
187
+ 45: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">every</span>(<span class="ruby-identifier">args</span>)
188
+ 46:
189
+ 47: <span class="ruby-comment cmt"># revert to basic singular lookup or raise an exception</span>
190
+ 48: <span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">raw</span>[<span class="ruby-value">0</span>])
191
+ 49: <span class="ruby-identifier">func</span> = <span class="ruby-identifier">raw</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>)
192
+ 50: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">func</span>,<span class="ruby-identifier">raw</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">week_position?</span>(<span class="ruby-identifier">func</span>)
193
+ 51: <span class="ruby-keyword kw">else</span>
194
+ 52: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoMethodError</span>
195
+ 53: <span class="ruby-keyword kw">end</span>
196
+ 54: <span class="ruby-keyword kw">end</span>
197
+ </pre>
198
+ </div>
199
+ </div>
200
+ </div>
201
+
202
+
203
+ </div>
204
+
205
+
206
+ </div>
207
+
208
+
209
+ <div id="validator-badges">
210
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
211
+ </div>
212
+
213
+ </body>
214
+ </html>
@@ -0,0 +1,178 @@
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>Module: SmartMonth::Magic::MonthFactory</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>Module</strong></td>
53
+ <td class="class-name-in-header">SmartMonth::Magic::MonthFactory</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/lib/smart_month/magic_rb.html">
59
+ lib/smart_month/magic.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <p>
77
+ This module allows your code to ignore the class instantiation, simply do
78
+ Month.june!
79
+ </p>
80
+
81
+ </div>
82
+
83
+
84
+ </div>
85
+
86
+ <div id="method-list">
87
+ <h3 class="section-bar">Methods</h3>
88
+
89
+ <div class="name-list">
90
+ <a href="#M000016">[]</a>&nbsp;&nbsp;
91
+ <a href="#M000015">method_missing</a>&nbsp;&nbsp;
92
+ </div>
93
+ </div>
94
+
95
+ </div>
96
+
97
+
98
+ <!-- if includes -->
99
+
100
+ <div id="section">
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+ <!-- if method_list -->
110
+ <div id="methods">
111
+ <h3 class="section-bar">Public Instance methods</h3>
112
+
113
+ <div id="method-M000016" class="method-detail">
114
+ <a name="M000016"></a>
115
+
116
+ <div class="method-heading">
117
+ <a href="#M000016" class="method-signature">
118
+ <span class="method-name">[]</span><span class="method-args">(month)</span>
119
+ </a>
120
+ </div>
121
+
122
+ <div class="method-description">
123
+ <p>
124
+ this allows you to essentially treat the month as a hash or array object to
125
+ construct new months.
126
+ </p>
127
+ <p><a class="source-toggle" href="#"
128
+ onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
129
+ <div class="method-source-code" id="M000016-source">
130
+ <pre>
131
+ <span class="ruby-comment cmt"># File lib/smart_month/magic.rb, line 18</span>
132
+ 18: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">month</span>)
133
+ 19: <span class="ruby-identifier">new</span>(<span class="ruby-identifier">month</span>)
134
+ 20: <span class="ruby-keyword kw">end</span>
135
+ </pre>
136
+ </div>
137
+ </div>
138
+ </div>
139
+
140
+ <div id="method-M000015" class="method-detail">
141
+ <a name="M000015"></a>
142
+
143
+ <div class="method-heading">
144
+ <a href="#M000015" class="method-signature">
145
+ <span class="method-name">method_missing</span><span class="method-args">(meth,*args)</span>
146
+ </a>
147
+ </div>
148
+
149
+ <div class="method-description">
150
+ <p>
151
+ singleton month factory
152
+ </p>
153
+ <p><a class="source-toggle" href="#"
154
+ onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
155
+ <div class="method-source-code" id="M000015-source">
156
+ <pre>
157
+ <span class="ruby-comment cmt"># File lib/smart_month/magic.rb, line 13</span>
158
+ 13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">meth</span>,<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
159
+ 14: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">new</span>(<span class="ruby-identifier">meth</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">capitalize</span>, (<span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">||</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">year</span>)) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Month</span><span class="ruby-operator">::</span><span class="ruby-constant">NAMES</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">meth</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">capitalize</span>
160
+ 15: <span class="ruby-keyword kw">end</span>
161
+ </pre>
162
+ </div>
163
+ </div>
164
+ </div>
165
+
166
+
167
+ </div>
168
+
169
+
170
+ </div>
171
+
172
+
173
+ <div id="validator-badges">
174
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
175
+ </div>
176
+
177
+ </body>
178
+ </html>
@@ -0,0 +1,311 @@
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>Module: SmartMonth::Math</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>Module</strong></td>
53
+ <td class="class-name-in-header">SmartMonth::Math</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/smart_month/math_rb.html">
59
+ lib/smart_month/math.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <p>
77
+ Responsible for all math related functionality.
78
+ </p>
79
+
80
+ </div>
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="#M000022">%</a>&nbsp;&nbsp;
90
+ <a href="#M000019">*</a>&nbsp;&nbsp;
91
+ <a href="#M000021">**</a>&nbsp;&nbsp;
92
+ <a href="#M000017">+</a>&nbsp;&nbsp;
93
+ <a href="#M000018">-</a>&nbsp;&nbsp;
94
+ <a href="#M000020">/</a>&nbsp;&nbsp;
95
+ <a href="#M000023">==</a>&nbsp;&nbsp;
96
+ </div>
97
+ </div>
98
+
99
+ </div>
100
+
101
+
102
+ <!-- if includes -->
103
+
104
+ <div id="section">
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+ <!-- if method_list -->
114
+ <div id="methods">
115
+ <h3 class="section-bar">Public Instance methods</h3>
116
+
117
+ <div id="method-M000022" class="method-detail">
118
+ <a name="M000022"></a>
119
+
120
+ <div class="method-heading">
121
+ <a href="#M000022" class="method-signature">
122
+ <span class="method-name">%</span><span class="method-args">(int)</span>
123
+ </a>
124
+ </div>
125
+
126
+ <div class="method-description">
127
+ <p>
128
+ modulos a number to the month value and returns a Fixnum.
129
+ </p>
130
+ <p><a class="source-toggle" href="#"
131
+ onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
132
+ <div class="method-source-code" id="M000022-source">
133
+ <pre>
134
+ <span class="ruby-comment cmt"># File lib/smart_month/math.rb, line 31</span>
135
+ 31: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">%</span>(<span class="ruby-identifier">int</span>)
136
+ 32: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">int</span>
137
+ 33: <span class="ruby-keyword kw">end</span>
138
+ </pre>
139
+ </div>
140
+ </div>
141
+ </div>
142
+
143
+ <div id="method-M000019" class="method-detail">
144
+ <a name="M000019"></a>
145
+
146
+ <div class="method-heading">
147
+ <a href="#M000019" class="method-signature">
148
+ <span class="method-name">*</span><span class="method-args">(int)</span>
149
+ </a>
150
+ </div>
151
+
152
+ <div class="method-description">
153
+ <p>
154
+ multiplies a number to the month value and returns a Fixnum.
155
+ </p>
156
+ <p><a class="source-toggle" href="#"
157
+ onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
158
+ <div class="method-source-code" id="M000019-source">
159
+ <pre>
160
+ <span class="ruby-comment cmt"># File lib/smart_month/math.rb, line 16</span>
161
+ 16: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">*</span>(<span class="ruby-identifier">int</span>)
162
+ 17: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">int</span>
163
+ 18: <span class="ruby-keyword kw">end</span>
164
+ </pre>
165
+ </div>
166
+ </div>
167
+ </div>
168
+
169
+ <div id="method-M000021" class="method-detail">
170
+ <a name="M000021"></a>
171
+
172
+ <div class="method-heading">
173
+ <a href="#M000021" class="method-signature">
174
+ <span class="method-name">**</span><span class="method-args">(int)</span>
175
+ </a>
176
+ </div>
177
+
178
+ <div class="method-description">
179
+ <p>
180
+ exponents a number to the month value and returns a Fixnum.
181
+ </p>
182
+ <p><a class="source-toggle" href="#"
183
+ onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
184
+ <div class="method-source-code" id="M000021-source">
185
+ <pre>
186
+ <span class="ruby-comment cmt"># File lib/smart_month/math.rb, line 26</span>
187
+ 26: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">**</span>(<span class="ruby-identifier">int</span>)
188
+ 27: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">**</span> <span class="ruby-identifier">int</span>
189
+ 28: <span class="ruby-keyword kw">end</span>
190
+ </pre>
191
+ </div>
192
+ </div>
193
+ </div>
194
+
195
+ <div id="method-M000017" class="method-detail">
196
+ <a name="M000017"></a>
197
+
198
+ <div class="method-heading">
199
+ <a href="#M000017" class="method-signature">
200
+ <span class="method-name">+</span><span class="method-args">(int)</span>
201
+ </a>
202
+ </div>
203
+
204
+ <div class="method-description">
205
+ <p>
206
+ adds a number to the month value and returns a Fixnum.
207
+ </p>
208
+ <p><a class="source-toggle" href="#"
209
+ onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
210
+ <div class="method-source-code" id="M000017-source">
211
+ <pre>
212
+ <span class="ruby-comment cmt"># File lib/smart_month/math.rb, line 6</span>
213
+ 6: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">+</span>(<span class="ruby-identifier">int</span>)
214
+ 7: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">int</span>
215
+ 8: <span class="ruby-keyword kw">end</span>
216
+ </pre>
217
+ </div>
218
+ </div>
219
+ </div>
220
+
221
+ <div id="method-M000018" class="method-detail">
222
+ <a name="M000018"></a>
223
+
224
+ <div class="method-heading">
225
+ <a href="#M000018" class="method-signature">
226
+ <span class="method-name">-</span><span class="method-args">(int)</span>
227
+ </a>
228
+ </div>
229
+
230
+ <div class="method-description">
231
+ <p>
232
+ subtracts a number to the month value and returns a Fixnum.
233
+ </p>
234
+ <p><a class="source-toggle" href="#"
235
+ onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
236
+ <div class="method-source-code" id="M000018-source">
237
+ <pre>
238
+ <span class="ruby-comment cmt"># File lib/smart_month/math.rb, line 11</span>
239
+ 11: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">-</span>(<span class="ruby-identifier">int</span>)
240
+ 12: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">int</span>
241
+ 13: <span class="ruby-keyword kw">end</span>
242
+ </pre>
243
+ </div>
244
+ </div>
245
+ </div>
246
+
247
+ <div id="method-M000020" class="method-detail">
248
+ <a name="M000020"></a>
249
+
250
+ <div class="method-heading">
251
+ <a href="#M000020" class="method-signature">
252
+ <span class="method-name">/</span><span class="method-args">(int)</span>
253
+ </a>
254
+ </div>
255
+
256
+ <div class="method-description">
257
+ <p>
258
+ divides a number to the month value and returns a Fixnum.
259
+ </p>
260
+ <p><a class="source-toggle" href="#"
261
+ onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
262
+ <div class="method-source-code" id="M000020-source">
263
+ <pre>
264
+ <span class="ruby-comment cmt"># File lib/smart_month/math.rb, line 21</span>
265
+ 21: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">/</span>(<span class="ruby-identifier">int</span>)
266
+ 22: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">int</span>
267
+ 23: <span class="ruby-keyword kw">end</span>
268
+ </pre>
269
+ </div>
270
+ </div>
271
+ </div>
272
+
273
+ <div id="method-M000023" class="method-detail">
274
+ <a name="M000023"></a>
275
+
276
+ <div class="method-heading">
277
+ <a href="#M000023" class="method-signature">
278
+ <span class="method-name">==</span><span class="method-args">(month)</span>
279
+ </a>
280
+ </div>
281
+
282
+ <div class="method-description">
283
+ <p>
284
+ compares the current month to another month.
285
+ </p>
286
+ <p><a class="source-toggle" href="#"
287
+ onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
288
+ <div class="method-source-code" id="M000023-source">
289
+ <pre>
290
+ <span class="ruby-comment cmt"># File lib/smart_month/math.rb, line 36</span>
291
+ 36: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">month</span>)
292
+ 37: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">inspect!</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">month</span>.<span class="ruby-identifier">inspect!</span>
293
+ 38: <span class="ruby-keyword kw">end</span>
294
+ </pre>
295
+ </div>
296
+ </div>
297
+ </div>
298
+
299
+
300
+ </div>
301
+
302
+
303
+ </div>
304
+
305
+
306
+ <div id="validator-badges">
307
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
308
+ </div>
309
+
310
+ </body>
311
+ </html>