mack_ruby_core_extensions 0.1.23 → 0.1.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/doc/classes/Array.html +465 -0
  2. data/doc/classes/Class.html +233 -0
  3. data/doc/classes/Float.html +148 -0
  4. data/doc/classes/Hash.html +233 -0
  5. data/doc/classes/Kernel.html +184 -0
  6. data/doc/classes/Mack/Utils/Inflector.html +422 -0
  7. data/doc/classes/Math.html +188 -0
  8. data/doc/classes/MethodNotImplemented.html +155 -0
  9. data/doc/classes/Module.html +203 -0
  10. data/doc/classes/NilClass.html +151 -0
  11. data/doc/classes/Object.html +472 -0
  12. data/doc/classes/String.html +977 -0
  13. data/doc/classes/Symbol.html +148 -0
  14. data/doc/created.rid +1 -0
  15. data/doc/files/README.html +151 -0
  16. data/doc/files/lib/extensions/array_rb.html +101 -0
  17. data/doc/files/lib/extensions/class_rb.html +101 -0
  18. data/doc/files/lib/extensions/float_rb.html +101 -0
  19. data/doc/files/lib/extensions/hash_rb.html +108 -0
  20. data/doc/files/lib/extensions/kernel_rb.html +109 -0
  21. data/doc/files/lib/extensions/math_rb.html +101 -0
  22. data/doc/files/lib/extensions/method_not_implemented_rb.html +108 -0
  23. data/doc/files/lib/extensions/module_rb.html +101 -0
  24. data/doc/files/lib/extensions/nil_rb.html +101 -0
  25. data/doc/files/lib/extensions/object_rb.html +101 -0
  26. data/doc/files/lib/extensions/string_rb.html +108 -0
  27. data/doc/files/lib/extensions/symbol_rb.html +101 -0
  28. data/doc/files/lib/mack_ruby_core_extensions_rb.html +101 -0
  29. data/doc/files/lib/utils/inflections_rb.html +101 -0
  30. data/doc/files/lib/utils/inflector_rb.html +108 -0
  31. data/doc/files/lib/utils/options_merger_rb.html +101 -0
  32. data/doc/fr_class_index.html +39 -0
  33. data/doc/fr_file_index.html +43 -0
  34. data/doc/fr_method_index.html +97 -0
  35. data/doc/index.html +24 -0
  36. data/doc/rdoc-style.css +208 -0
  37. data/lib/extensions/hash.rb +0 -13
  38. data/lib/extensions/object.rb +4 -0
  39. data/lib/mack_ruby_core_extensions.rb +1 -1
  40. data/lib/utils/options_merger.rb +27 -0
  41. data/test/extensions/hash_test.rb +0 -14
  42. data/test/extensions/object_test.rb +16 -0
  43. data/test/test_helper.rb +16 -0
  44. metadata +40 -3
@@ -0,0 +1,184 @@
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: Kernel</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">Kernel</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/extensions/kernel_rb.html">
59
+ lib/extensions/kernel.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
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000067">pp_to_s</a>&nbsp;&nbsp;
84
+ <a href="#M000068">retryable</a>&nbsp;&nbsp;
85
+ </div>
86
+ </div>
87
+
88
+ </div>
89
+
90
+
91
+ <!-- if includes -->
92
+
93
+ <div id="section">
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+ <!-- if method_list -->
103
+ <div id="methods">
104
+ <h3 class="section-bar">Public Instance methods</h3>
105
+
106
+ <div id="method-M000067" class="method-detail">
107
+ <a name="M000067"></a>
108
+
109
+ <div class="method-heading">
110
+ <a href="#M000067" class="method-signature">
111
+ <span class="method-name">pp_to_s</span><span class="method-args">(object)</span>
112
+ </a>
113
+ </div>
114
+
115
+ <div class="method-description">
116
+ <p><a class="source-toggle" href="#"
117
+ onclick="toggleCode('M000067-source');return false;">[Source]</a></p>
118
+ <div class="method-source-code" id="M000067-source">
119
+ <pre>
120
+ <span class="ruby-comment cmt"># File lib/extensions/kernel.rb, line 6</span>
121
+ 6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_to_s</span>(<span class="ruby-identifier">object</span>)
122
+ 7: <span class="ruby-identifier">pp_out</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
123
+ 8: <span class="ruby-constant">PP</span>.<span class="ruby-identifier">pp</span>(<span class="ruby-identifier">object</span>,<span class="ruby-identifier">pp_out</span>)
124
+ 9: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pp_out</span>.<span class="ruby-identifier">string</span>
125
+ 10: <span class="ruby-keyword kw">end</span>
126
+ </pre>
127
+ </div>
128
+ </div>
129
+ </div>
130
+
131
+ <div id="method-M000068" class="method-detail">
132
+ <a name="M000068"></a>
133
+
134
+ <div class="method-heading">
135
+ <a href="#M000068" class="method-signature">
136
+ <span class="method-name">retryable</span><span class="method-args">(options = {}, &amp;block)</span>
137
+ </a>
138
+ </div>
139
+
140
+ <div class="method-description">
141
+ <p><a class="source-toggle" href="#"
142
+ onclick="toggleCode('M000068-source');return false;">[Source]</a></p>
143
+ <div class="method-source-code" id="M000068-source">
144
+ <pre>
145
+ <span class="ruby-comment cmt"># File lib/extensions/kernel.rb, line 12</span>
146
+ 12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">retryable</span>(<span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
147
+ 13: <span class="ruby-identifier">opts</span> = { <span class="ruby-identifier">:tries</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>, <span class="ruby-identifier">:on</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Exception</span> }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
148
+ 14:
149
+ 15: <span class="ruby-identifier">retries</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:tries</span>]
150
+ 16: <span class="ruby-identifier">retry_exceptions</span> = [<span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:on</span>]].<span class="ruby-identifier">flatten</span>
151
+ 17:
152
+ 18: <span class="ruby-identifier">x</span> = <span class="ruby-node">%{
153
+ 19: begin
154
+ 20: return yield
155
+ 21: rescue #{retry_exceptions.join(&quot;, &quot;)} =&gt; e
156
+ 22: retries -= 1
157
+ 23: if retries &gt; 0
158
+ 24: retry
159
+ 25: else
160
+ 26: raise e
161
+ 27: end
162
+ 28: end
163
+ 29: }</span>
164
+ 30:
165
+ 31: <span class="ruby-identifier">eval</span>(<span class="ruby-identifier">x</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
166
+ 32: <span class="ruby-keyword kw">end</span>
167
+ </pre>
168
+ </div>
169
+ </div>
170
+ </div>
171
+
172
+
173
+ </div>
174
+
175
+
176
+ </div>
177
+
178
+
179
+ <div id="validator-badges">
180
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
181
+ </div>
182
+
183
+ </body>
184
+ </html>
@@ -0,0 +1,422 @@
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: Mack::Utils::Inflector</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">Mack::Utils::Inflector</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/lib/utils/inflector_rb.html">
59
+ lib/utils/inflector.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
+ <a href="../../Object.html">
69
+ Object
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+ <div id="description">
84
+ <p>
85
+ This class is used to deal with inflection strings. This means taken a
86
+ string and make it <a href="Inflector.html#M000060">plural</a>, or <a
87
+ href="Inflector.html#M000061">singular</a>, etc&#8230; Inflection rules can
88
+ be added very easy, and are checked from the bottom up. This means that the
89
+ last rule is the first rule to be matched. The exception to this, kind of,
90
+ is &#8216;<a href="Inflector.html#M000062">irregular</a>&#8217; and
91
+ &#8216;<a href="Inflector.html#M000063">uncountable</a>&#8217; rules. The
92
+ &#8216;<a href="Inflector.html#M000063">uncountable</a>&#8217; rules are
93
+ always checked first, then the &#8216;<a
94
+ href="Inflector.html#M000062">irregular</a>&#8217; rules, and finally
95
+ either the &#8216;<a href="Inflector.html#M000061">singular</a>&#8217; or
96
+ &#8216;<a href="Inflector.html#M000060">plural</a>&#8217; rules, depending
97
+ on what you&#8216;re trying to do. Within each of these sets of rules, the
98
+ last rule in is the first rule matched.
99
+ </p>
100
+ <p>
101
+ Example:
102
+ </p>
103
+ <pre>
104
+ Mack::Utils::Inflector.inflections do |inflect|
105
+ inflect.plural(/$/, 's')
106
+ inflect.plural(/^(ox)$/i, '\1en')
107
+ inflect.plural(/(phenomen|criteri)on$/i, '\1a')
108
+
109
+ inflect.singular(/s$/i, '')
110
+ inflect.singular(/(n)ews$/i, '\1ews')
111
+ inflect.singular(/^(.*)ookies$/, '\1ookie')
112
+
113
+ inflect.irregular('person', 'people')
114
+ inflect.irregular('child', 'children')
115
+
116
+ inflect.uncountable(%w(fish sheep deer offspring))
117
+ end
118
+ </pre>
119
+
120
+ </div>
121
+
122
+
123
+ </div>
124
+
125
+ <div id="method-list">
126
+ <h3 class="section-bar">Methods</h3>
127
+
128
+ <div class="name-list">
129
+ <a href="#M000066">inflections</a>&nbsp;&nbsp;
130
+ <a href="#M000062">irregular</a>&nbsp;&nbsp;
131
+ <a href="#M000060">plural</a>&nbsp;&nbsp;
132
+ <a href="#M000065">pluralize</a>&nbsp;&nbsp;
133
+ <a href="#M000061">singular</a>&nbsp;&nbsp;
134
+ <a href="#M000064">singularize</a>&nbsp;&nbsp;
135
+ <a href="#M000063">uncountable</a>&nbsp;&nbsp;
136
+ </div>
137
+ </div>
138
+
139
+ </div>
140
+
141
+
142
+ <!-- if includes -->
143
+ <div id="includes">
144
+ <h3 class="section-bar">Included Modules</h3>
145
+
146
+ <div id="includes-list">
147
+ <span class="include-name">Singleton</span>
148
+ </div>
149
+ </div>
150
+
151
+ <div id="section">
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+ <!-- if method_list -->
161
+ <div id="methods">
162
+ <h3 class="section-bar">Public Class methods</h3>
163
+
164
+ <div id="method-M000066" class="method-detail">
165
+ <a name="M000066"></a>
166
+
167
+ <div class="method-heading">
168
+ <a href="#M000066" class="method-signature">
169
+ <span class="method-name">inflections</span><span class="method-args">() {|Mack::Utils::Inflector.instance| ...}</span>
170
+ </a>
171
+ </div>
172
+
173
+ <div class="method-description">
174
+ <p>
175
+ Yields up Mack::Utils::Inflector.instance
176
+ </p>
177
+ <p><a class="source-toggle" href="#"
178
+ onclick="toggleCode('M000066-source');return false;">[Source]</a></p>
179
+ <div class="method-source-code" id="M000066-source">
180
+ <pre>
181
+ <span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 121</span>
182
+ 121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inflections</span>
183
+ 122: <span class="ruby-keyword kw">yield</span> <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflector</span>.<span class="ruby-identifier">instance</span>
184
+ 123: <span class="ruby-keyword kw">end</span>
185
+ </pre>
186
+ </div>
187
+ </div>
188
+ </div>
189
+
190
+ <h3 class="section-bar">Public Instance methods</h3>
191
+
192
+ <div id="method-M000062" class="method-detail">
193
+ <a name="M000062"></a>
194
+
195
+ <div class="method-heading">
196
+ <a href="#M000062" class="method-signature">
197
+ <span class="method-name">irregular</span><span class="method-args">(rule, replacement)</span>
198
+ </a>
199
+ </div>
200
+
201
+ <div class="method-description">
202
+ <p>
203
+ Adds a <a href="Inflector.html#M000062">irregular</a> rule to the system.
204
+ </p>
205
+ <p>
206
+ Example:
207
+ </p>
208
+ <pre>
209
+ Mack::Utils::Inflector.inflections do |inflect|
210
+ inflect.irregular('person', 'people')
211
+ inflect.irregular('child', 'children')
212
+ end
213
+ </pre>
214
+ <p><a class="source-toggle" href="#"
215
+ onclick="toggleCode('M000062-source');return false;">[Source]</a></p>
216
+ <div class="method-source-code" id="M000062-source">
217
+ <pre>
218
+ <span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 66</span>
219
+ 66: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">irregular</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>)
220
+ 67: <span class="ruby-ivar">@irregular_rules</span> <span class="ruby-operator">&lt;&lt;</span> {<span class="ruby-identifier">:rule</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">:replacement</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">replacement</span>}
221
+ 68: <span class="ruby-comment cmt"># do the reverse so you get:</span>
222
+ 69: <span class="ruby-comment cmt"># person =&gt; people</span>
223
+ 70: <span class="ruby-comment cmt"># people =&gt; person</span>
224
+ 71: <span class="ruby-ivar">@irregular_rules</span> <span class="ruby-operator">&lt;&lt;</span> {<span class="ruby-identifier">:rule</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">replacement</span>, <span class="ruby-identifier">:replacement</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">rule</span>}
225
+ 72: <span class="ruby-keyword kw">end</span>
226
+ </pre>
227
+ </div>
228
+ </div>
229
+ </div>
230
+
231
+ <div id="method-M000060" class="method-detail">
232
+ <a name="M000060"></a>
233
+
234
+ <div class="method-heading">
235
+ <a href="#M000060" class="method-signature">
236
+ <span class="method-name">plural</span><span class="method-args">(rule, replacement)</span>
237
+ </a>
238
+ </div>
239
+
240
+ <div class="method-description">
241
+ <p>
242
+ Adds a <a href="Inflector.html#M000060">plural</a> rule to the system.
243
+ </p>
244
+ <p>
245
+ Example:
246
+ </p>
247
+ <pre>
248
+ Mack::Utils::Inflector.inflections do |inflect|
249
+ inflect.plural(/$/, 's')
250
+ inflect.plural(/^(ox)$/i, '\1en')
251
+ inflect.plural(/(phenomen|criteri)on$/i, '\1a')
252
+ end
253
+ </pre>
254
+ <p><a class="source-toggle" href="#"
255
+ onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
256
+ <div class="method-source-code" id="M000060-source">
257
+ <pre>
258
+ <span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 43</span>
259
+ 43: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">plural</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>)
260
+ 44: <span class="ruby-ivar">@plural_rules</span> <span class="ruby-operator">&lt;&lt;</span> {<span class="ruby-identifier">:rule</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">:replacement</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">replacement</span>}
261
+ 45: <span class="ruby-keyword kw">end</span>
262
+ </pre>
263
+ </div>
264
+ </div>
265
+ </div>
266
+
267
+ <div id="method-M000065" class="method-detail">
268
+ <a name="M000065"></a>
269
+
270
+ <div class="method-heading">
271
+ <a href="#M000065" class="method-signature">
272
+ <span class="method-name">pluralize</span><span class="method-args">(word)</span>
273
+ </a>
274
+ </div>
275
+
276
+ <div class="method-description">
277
+ <p>
278
+ Returns the <a href="Inflector.html#M000061">singular</a> version of the
279
+ word, if possible.
280
+ </p>
281
+ <p>
282
+ Examples:
283
+ </p>
284
+ <pre>
285
+ Mack::Utils::Inflector.instance.pluralize(&quot;army&quot;) # =&gt; &quot;armies&quot;
286
+ Mack::Utils::Inflector.instance.pluralize(&quot;person&quot;) # =&gt; &quot;people&quot;
287
+ Mack::Utils::Inflector.instance.pluralize(&quot;boat&quot;) # =&gt; &quot;boats&quot;
288
+ </pre>
289
+ <p><a class="source-toggle" href="#"
290
+ onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
291
+ <div class="method-source-code" id="M000065-source">
292
+ <pre>
293
+ <span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 102</span>
294
+ 102: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pluralize</span>(<span class="ruby-identifier">word</span>)
295
+ 103: <span class="ruby-identifier">do_work</span>(<span class="ruby-identifier">word</span>, <span class="ruby-ivar">@plural_rules</span>)
296
+ 104: <span class="ruby-keyword kw">end</span>
297
+ </pre>
298
+ </div>
299
+ </div>
300
+ </div>
301
+
302
+ <div id="method-M000061" class="method-detail">
303
+ <a name="M000061"></a>
304
+
305
+ <div class="method-heading">
306
+ <a href="#M000061" class="method-signature">
307
+ <span class="method-name">singular</span><span class="method-args">(rule, replacement)</span>
308
+ </a>
309
+ </div>
310
+
311
+ <div class="method-description">
312
+ <p>
313
+ Adds a <a href="Inflector.html#M000061">singular</a> rule to the system.
314
+ </p>
315
+ <p>
316
+ Example:
317
+ </p>
318
+ <pre>
319
+ Mack::Utils::Inflector.inflections do |inflect|
320
+ inflect.singular(/s$/i, '')
321
+ inflect.singular(/(n)ews$/i, '\1ews')
322
+ inflect.singular(/^(.*)ookies$/, '\1ookie')
323
+ end
324
+ </pre>
325
+ <p><a class="source-toggle" href="#"
326
+ onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
327
+ <div class="method-source-code" id="M000061-source">
328
+ <pre>
329
+ <span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 55</span>
330
+ 55: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">singular</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>)
331
+ 56: <span class="ruby-ivar">@singular_rules</span> <span class="ruby-operator">&lt;&lt;</span> {<span class="ruby-identifier">:rule</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">:replacement</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">replacement</span>}
332
+ 57: <span class="ruby-keyword kw">end</span>
333
+ </pre>
334
+ </div>
335
+ </div>
336
+ </div>
337
+
338
+ <div id="method-M000064" class="method-detail">
339
+ <a name="M000064"></a>
340
+
341
+ <div class="method-heading">
342
+ <a href="#M000064" class="method-signature">
343
+ <span class="method-name">singularize</span><span class="method-args">(word)</span>
344
+ </a>
345
+ </div>
346
+
347
+ <div class="method-description">
348
+ <p>
349
+ Returns the <a href="Inflector.html#M000061">singular</a> version of the
350
+ word, if possible.
351
+ </p>
352
+ <p>
353
+ Examples:
354
+ </p>
355
+ <pre>
356
+ Mack::Utils::Inflector.instance.singularize(&quot;armies&quot;) # =&gt; &quot;army&quot;
357
+ Mack::Utils::Inflector.instance.singularize(&quot;people&quot;) # =&gt; &quot;person&quot;
358
+ Mack::Utils::Inflector.instance.singularize(&quot;boats&quot;) # =&gt; &quot;boat&quot;
359
+ </pre>
360
+ <p><a class="source-toggle" href="#"
361
+ onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
362
+ <div class="method-source-code" id="M000064-source">
363
+ <pre>
364
+ <span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 92</span>
365
+ 92: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">singularize</span>(<span class="ruby-identifier">word</span>)
366
+ 93: <span class="ruby-identifier">do_work</span>(<span class="ruby-identifier">word</span>, <span class="ruby-ivar">@singular_rules</span>)
367
+ 94: <span class="ruby-keyword kw">end</span>
368
+ </pre>
369
+ </div>
370
+ </div>
371
+ </div>
372
+
373
+ <div id="method-M000063" class="method-detail">
374
+ <a name="M000063"></a>
375
+
376
+ <div class="method-heading">
377
+ <a href="#M000063" class="method-signature">
378
+ <span class="method-name">uncountable</span><span class="method-args">(*args)</span>
379
+ </a>
380
+ </div>
381
+
382
+ <div class="method-description">
383
+ <p>
384
+ Adds a <a href="Inflector.html#M000063">uncountable</a> word, or words, to
385
+ the system.
386
+ </p>
387
+ <p>
388
+ Example:
389
+ </p>
390
+ <pre>
391
+ Mack::Utils::Inflector.inflections do |inflect|
392
+ inflect.uncountable(%w(fish sheep deer offspring))
393
+ end
394
+ </pre>
395
+ <p><a class="source-toggle" href="#"
396
+ onclick="toggleCode('M000063-source');return false;">[Source]</a></p>
397
+ <div class="method-source-code" id="M000063-source">
398
+ <pre>
399
+ <span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 80</span>
400
+ 80: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uncountable</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
401
+ 81: [<span class="ruby-identifier">args</span>].<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">word</span><span class="ruby-operator">|</span>
402
+ 82: <span class="ruby-ivar">@uncountable_rules</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">word</span>.<span class="ruby-identifier">downcase</span>
403
+ 83: <span class="ruby-keyword kw">end</span>
404
+ 84: <span class="ruby-keyword kw">end</span>
405
+ </pre>
406
+ </div>
407
+ </div>
408
+ </div>
409
+
410
+
411
+ </div>
412
+
413
+
414
+ </div>
415
+
416
+
417
+ <div id="validator-badges">
418
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
419
+ </div>
420
+
421
+ </body>
422
+ </html>