mack-facets 0.6.0 → 0.6.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,233 @@
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: Hash</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">Hash</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/extensions/hash_rb.html">
59
+ lib/extensions/hash.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
+
84
+
85
+ </div>
86
+
87
+ <div id="method-list">
88
+ <h3 class="section-bar">Methods</h3>
89
+
90
+ <div class="name-list">
91
+ <a href="#M000003">-</a>&nbsp;&nbsp;
92
+ <a href="#M000002">join</a>&nbsp;&nbsp;
93
+ <a href="#M000004">to_params</a>&nbsp;&nbsp;
94
+ </div>
95
+ </div>
96
+
97
+ </div>
98
+
99
+
100
+ <!-- if includes -->
101
+
102
+ <div id="section">
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+ <!-- if method_list -->
112
+ <div id="methods">
113
+ <h3 class="section-bar">Public Instance methods</h3>
114
+
115
+ <div id="method-M000003" class="method-detail">
116
+ <a name="M000003"></a>
117
+
118
+ <div class="method-heading">
119
+ <a href="#M000003" class="method-signature">
120
+ <span class="method-name">-</span><span class="method-args">(ars)</span>
121
+ </a>
122
+ </div>
123
+
124
+ <div class="method-description">
125
+ <p>
126
+ Deletes the key(s) passed in from the hash.
127
+ </p>
128
+ <p><a class="source-toggle" href="#"
129
+ onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
130
+ <div class="method-source-code" id="M000003-source">
131
+ <pre>
132
+ <span class="ruby-comment cmt"># File lib/extensions/hash.rb, line 14</span>
133
+ 14: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">-</span>(<span class="ruby-identifier">ars</span>)
134
+ 15: [<span class="ruby-identifier">ars</span>].<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">a</span>)}
135
+ 16: <span class="ruby-keyword kw">self</span>
136
+ 17: <span class="ruby-keyword kw">end</span>
137
+ </pre>
138
+ </div>
139
+ </div>
140
+ </div>
141
+
142
+ <div id="method-M000002" class="method-detail">
143
+ <a name="M000002"></a>
144
+
145
+ <div class="method-heading">
146
+ <a href="#M000002" class="method-signature">
147
+ <span class="method-name">join</span><span class="method-args">(pair_string, join_string)</span>
148
+ </a>
149
+ </div>
150
+
151
+ <div class="method-description">
152
+ <p><a class="source-toggle" href="#"
153
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
154
+ <div class="method-source-code" id="M000002-source">
155
+ <pre>
156
+ <span class="ruby-comment cmt"># File lib/extensions/hash.rb, line 4</span>
157
+ 4: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">join</span>(<span class="ruby-identifier">pair_string</span>, <span class="ruby-identifier">join_string</span>)
158
+ 5: <span class="ruby-identifier">output</span> = []
159
+ 6: <span class="ruby-identifier">sorted</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sort</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span>,<span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">b</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_s</span>}
160
+ 7: <span class="ruby-identifier">sorted</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ar</span><span class="ruby-operator">|</span>
161
+ 8: <span class="ruby-identifier">output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-identifier">pair_string</span>, <span class="ruby-identifier">ar</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">ar</span>[<span class="ruby-value">1</span>])
162
+ 9: <span class="ruby-keyword kw">end</span>
163
+ 10: <span class="ruby-identifier">output</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">join_string</span>)
164
+ 11: <span class="ruby-keyword kw">end</span>
165
+ </pre>
166
+ </div>
167
+ </div>
168
+ </div>
169
+
170
+ <div id="method-M000004" class="method-detail">
171
+ <a name="M000004"></a>
172
+
173
+ <div class="method-heading">
174
+ <a href="#M000004" class="method-signature">
175
+ <span class="method-name">to_params</span><span class="method-args">(escape = true)</span>
176
+ </a>
177
+ </div>
178
+
179
+ <div class="method-description">
180
+ <p>
181
+ Converts a hash to query string parameters. An optional boolean escapes the
182
+ values if true, which is the default.
183
+ </p>
184
+ <p><a class="source-toggle" href="#"
185
+ onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
186
+ <div class="method-source-code" id="M000004-source">
187
+ <pre>
188
+ <span class="ruby-comment cmt"># File lib/extensions/hash.rb, line 21</span>
189
+ 21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_params</span>(<span class="ruby-identifier">escape</span> = <span class="ruby-keyword kw">true</span>)
190
+ 22: <span class="ruby-identifier">params</span> = <span class="ruby-value str">''</span>
191
+ 23: <span class="ruby-identifier">stack</span> = []
192
+ 24:
193
+ 25: <span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
194
+ 26: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
195
+ 27: <span class="ruby-identifier">stack</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>]
196
+ 28: <span class="ruby-keyword kw">else</span>
197
+ 29: <span class="ruby-identifier">v</span> = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">uri_escape</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">escape</span>
198
+ 30: <span class="ruby-identifier">params</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{k}=#{v}&amp;&quot;</span>
199
+ 31: <span class="ruby-keyword kw">end</span>
200
+ 32: <span class="ruby-keyword kw">end</span>
201
+ 33:
202
+ 34: <span class="ruby-identifier">stack</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">parent</span>, <span class="ruby-identifier">hash</span><span class="ruby-operator">|</span>
203
+ 35: <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
204
+ 36: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
205
+ 37: <span class="ruby-identifier">stack</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-node">&quot;#{parent}[#{k}]&quot;</span>, <span class="ruby-identifier">v</span>]
206
+ 38: <span class="ruby-keyword kw">else</span>
207
+ 39: <span class="ruby-identifier">v</span> = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">uri_escape</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">escape</span>
208
+ 40: <span class="ruby-identifier">params</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{parent}[#{k}]=#{v}&amp;&quot;</span>
209
+ 41: <span class="ruby-keyword kw">end</span>
210
+ 42: <span class="ruby-keyword kw">end</span>
211
+ 43: <span class="ruby-keyword kw">end</span>
212
+ 44:
213
+ 45: <span class="ruby-identifier">params</span>.<span class="ruby-identifier">chop!</span> <span class="ruby-comment cmt"># trailing &amp;</span>
214
+ 46: <span class="ruby-identifier">params</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;&amp;&quot;</span>).<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;&amp;&quot;</span>)
215
+ 47: <span class="ruby-keyword kw">end</span>
216
+ </pre>
217
+ </div>
218
+ </div>
219
+ </div>
220
+
221
+
222
+ </div>
223
+
224
+
225
+ </div>
226
+
227
+
228
+ <div id="validator-badges">
229
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
230
+ </div>
231
+
232
+ </body>
233
+ </html>
@@ -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="#M000045">pp_to_s</a>&nbsp;&nbsp;
84
+ <a href="#M000046">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-M000045" class="method-detail">
107
+ <a name="M000045"></a>
108
+
109
+ <div class="method-heading">
110
+ <a href="#M000045" 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('M000045-source');return false;">[Source]</a></p>
118
+ <div class="method-source-code" id="M000045-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-M000046" class="method-detail">
132
+ <a name="M000046"></a>
133
+
134
+ <div class="method-heading">
135
+ <a href="#M000046" 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('M000046-source');return false;">[Source]</a></p>
143
+ <div class="method-source-code" id="M000046-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,382 @@
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#M000039">plural</a>, or <a
87
+ href="Inflector.html#M000040">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#M000041">irregular</a>&#8217; and
91
+ &#8216;uncountable&#8217; rules. The &#8216;uncountable&#8217; rules are
92
+ always checked first, then the &#8216;<a
93
+ href="Inflector.html#M000041">irregular</a>&#8217; rules, and finally
94
+ either the &#8216;<a href="Inflector.html#M000040">singular</a>&#8217; or
95
+ &#8216;<a href="Inflector.html#M000039">plural</a>&#8217; rules, depending
96
+ on what you&#8216;re trying to do. Within each of these sets of rules, the
97
+ last rule in is the first rule matched.
98
+ </p>
99
+ <p>
100
+ Example:
101
+ </p>
102
+ <pre>
103
+ Mack::Utils::Inflector.inflections do |inflect|
104
+ inflect.plural(/$/, 's')
105
+ inflect.plural(/^(ox)$/i, '\1en')
106
+ inflect.plural(/(phenomen|criteri)on$/i, '\1a')
107
+
108
+ inflect.singular(/s$/i, '')
109
+ inflect.singular(/(n)ews$/i, '\1ews')
110
+ inflect.singular(/^(.*)ookies$/, '\1ookie')
111
+
112
+ inflect.irregular('person', 'people')
113
+ inflect.irregular('child', 'children')
114
+ end
115
+ </pre>
116
+
117
+ </div>
118
+
119
+
120
+ </div>
121
+
122
+ <div id="method-list">
123
+ <h3 class="section-bar">Methods</h3>
124
+
125
+ <div class="name-list">
126
+ <a href="#M000044">inflections</a>&nbsp;&nbsp;
127
+ <a href="#M000041">irregular</a>&nbsp;&nbsp;
128
+ <a href="#M000039">plural</a>&nbsp;&nbsp;
129
+ <a href="#M000043">pluralize</a>&nbsp;&nbsp;
130
+ <a href="#M000040">singular</a>&nbsp;&nbsp;
131
+ <a href="#M000042">singularize</a>&nbsp;&nbsp;
132
+ </div>
133
+ </div>
134
+
135
+ </div>
136
+
137
+
138
+ <!-- if includes -->
139
+ <div id="includes">
140
+ <h3 class="section-bar">Included Modules</h3>
141
+
142
+ <div id="includes-list">
143
+ <span class="include-name">Singleton</span>
144
+ </div>
145
+ </div>
146
+
147
+ <div id="section">
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+ <!-- if method_list -->
157
+ <div id="methods">
158
+ <h3 class="section-bar">Public Class methods</h3>
159
+
160
+ <div id="method-M000044" class="method-detail">
161
+ <a name="M000044"></a>
162
+
163
+ <div class="method-heading">
164
+ <a href="#M000044" class="method-signature">
165
+ <span class="method-name">inflections</span><span class="method-args">() {|Mack::Utils::Inflector.instance| ...}</span>
166
+ </a>
167
+ </div>
168
+
169
+ <div class="method-description">
170
+ <p>
171
+ Yields up Mack::Utils::Inflector.instance
172
+ </p>
173
+ <p><a class="source-toggle" href="#"
174
+ onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
175
+ <div class="method-source-code" id="M000044-source">
176
+ <pre>
177
+ <span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 87</span>
178
+ 87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inflections</span>
179
+ 88: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
180
+ 89: <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>
181
+ 90: <span class="ruby-keyword kw">else</span>
182
+ 91: <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>
183
+ 92: <span class="ruby-keyword kw">end</span>
184
+ 93: <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-M000041" class="method-detail">
193
+ <a name="M000041"></a>
194
+
195
+ <div class="method-heading">
196
+ <a href="#M000041" 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#M000041">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('M000041-source');return false;">[Source]</a></p>
216
+ <div class="method-source-code" id="M000041-source">
217
+ <pre>
218
+ <span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 58</span>
219
+ 58: <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
+ 59: <span class="ruby-constant">English</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflect</span>.<span class="ruby-identifier">rule</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>)
221
+ 60: <span class="ruby-constant">English</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflect</span>.<span class="ruby-identifier">word</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>)
222
+ 61: <span class="ruby-keyword kw">end</span>
223
+ </pre>
224
+ </div>
225
+ </div>
226
+ </div>
227
+
228
+ <div id="method-M000039" class="method-detail">
229
+ <a name="M000039"></a>
230
+
231
+ <div class="method-heading">
232
+ <a href="#M000039" class="method-signature">
233
+ <span class="method-name">plural</span><span class="method-args">(rule, replacement)</span>
234
+ </a>
235
+ </div>
236
+
237
+ <div class="method-description">
238
+ <p>
239
+ Adds a <a href="Inflector.html#M000039">plural</a> rule to the system.
240
+ </p>
241
+ <p>
242
+ Example:
243
+ </p>
244
+ <pre>
245
+ Mack::Utils::Inflector.inflections do |inflect|
246
+ inflect.plural(/$/, 's')
247
+ inflect.plural(/^(ox)$/i, '\1en')
248
+ inflect.plural(/(phenomen|criteri)on$/i, '\1a')
249
+ end
250
+ </pre>
251
+ <p><a class="source-toggle" href="#"
252
+ onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
253
+ <div class="method-source-code" id="M000039-source">
254
+ <pre>
255
+ <span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 35</span>
256
+ 35: <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>)
257
+ 36: <span class="ruby-constant">English</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflect</span>.<span class="ruby-identifier">plural_rule</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>)
258
+ 37: <span class="ruby-keyword kw">end</span>
259
+ </pre>
260
+ </div>
261
+ </div>
262
+ </div>
263
+
264
+ <div id="method-M000043" class="method-detail">
265
+ <a name="M000043"></a>
266
+
267
+ <div class="method-heading">
268
+ <a href="#M000043" class="method-signature">
269
+ <span class="method-name">pluralize</span><span class="method-args">(word)</span>
270
+ </a>
271
+ </div>
272
+
273
+ <div class="method-description">
274
+ <p>
275
+ Returns the <a href="Inflector.html#M000040">singular</a> version of the
276
+ word, if possible.
277
+ </p>
278
+ <p>
279
+ Examples:
280
+ </p>
281
+ <pre>
282
+ Mack::Utils::Inflector.instance.pluralize(&quot;army&quot;) # =&gt; &quot;armies&quot;
283
+ Mack::Utils::Inflector.instance.pluralize(&quot;person&quot;) # =&gt; &quot;people&quot;
284
+ Mack::Utils::Inflector.instance.pluralize(&quot;boat&quot;) # =&gt; &quot;boats&quot;
285
+ </pre>
286
+ <p><a class="source-toggle" href="#"
287
+ onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
288
+ <div class="method-source-code" id="M000043-source">
289
+ <pre>
290
+ <span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 79</span>
291
+ 79: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pluralize</span>(<span class="ruby-identifier">word</span>)
292
+ 80: <span class="ruby-constant">English</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflect</span>.<span class="ruby-identifier">plural</span>(<span class="ruby-identifier">word</span>)
293
+ 81: <span class="ruby-keyword kw">end</span>
294
+ </pre>
295
+ </div>
296
+ </div>
297
+ </div>
298
+
299
+ <div id="method-M000040" class="method-detail">
300
+ <a name="M000040"></a>
301
+
302
+ <div class="method-heading">
303
+ <a href="#M000040" class="method-signature">
304
+ <span class="method-name">singular</span><span class="method-args">(rule, replacement)</span>
305
+ </a>
306
+ </div>
307
+
308
+ <div class="method-description">
309
+ <p>
310
+ Adds a <a href="Inflector.html#M000040">singular</a> rule to the system.
311
+ </p>
312
+ <p>
313
+ Example:
314
+ </p>
315
+ <pre>
316
+ Mack::Utils::Inflector.inflections do |inflect|
317
+ inflect.singular(/s$/i, '')
318
+ inflect.singular(/(n)ews$/i, '\1ews')
319
+ inflect.singular(/^(.*)ookies$/, '\1ookie')
320
+ end
321
+ </pre>
322
+ <p><a class="source-toggle" href="#"
323
+ onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
324
+ <div class="method-source-code" id="M000040-source">
325
+ <pre>
326
+ <span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 47</span>
327
+ 47: <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>)
328
+ 48: <span class="ruby-constant">English</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflect</span>.<span class="ruby-identifier">singular_rule</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>)
329
+ 49: <span class="ruby-keyword kw">end</span>
330
+ </pre>
331
+ </div>
332
+ </div>
333
+ </div>
334
+
335
+ <div id="method-M000042" class="method-detail">
336
+ <a name="M000042"></a>
337
+
338
+ <div class="method-heading">
339
+ <a href="#M000042" class="method-signature">
340
+ <span class="method-name">singularize</span><span class="method-args">(word)</span>
341
+ </a>
342
+ </div>
343
+
344
+ <div class="method-description">
345
+ <p>
346
+ Returns the <a href="Inflector.html#M000040">singular</a> version of the
347
+ word, if possible.
348
+ </p>
349
+ <p>
350
+ Examples:
351
+ </p>
352
+ <pre>
353
+ Mack::Utils::Inflector.instance.singularize(&quot;armies&quot;) # =&gt; &quot;army&quot;
354
+ Mack::Utils::Inflector.instance.singularize(&quot;people&quot;) # =&gt; &quot;person&quot;
355
+ Mack::Utils::Inflector.instance.singularize(&quot;boats&quot;) # =&gt; &quot;boat&quot;
356
+ </pre>
357
+ <p><a class="source-toggle" href="#"
358
+ onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
359
+ <div class="method-source-code" id="M000042-source">
360
+ <pre>
361
+ <span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 69</span>
362
+ 69: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">singularize</span>(<span class="ruby-identifier">word</span>)
363
+ 70: <span class="ruby-constant">English</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflect</span>.<span class="ruby-identifier">singular</span>(<span class="ruby-identifier">word</span>)
364
+ 71: <span class="ruby-keyword kw">end</span>
365
+ </pre>
366
+ </div>
367
+ </div>
368
+ </div>
369
+
370
+
371
+ </div>
372
+
373
+
374
+ </div>
375
+
376
+
377
+ <div id="validator-badges">
378
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
379
+ </div>
380
+
381
+ </body>
382
+ </html>