mack_ruby_core_extensions 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/classes/Kernel.html +12 -12
- data/doc/classes/Mack/Utils/Inflector.html +56 -56
- data/doc/classes/Math.html +18 -18
- data/doc/classes/Object.html +111 -83
- data/doc/classes/String.html +144 -144
- data/doc/created.rid +1 -1
- data/doc/files/README.html +2 -3
- data/doc/files/lib/extensions/object_rb.html +1 -1
- data/doc/files/lib/utils/inflector_rb.html +1 -1
- data/doc/fr_class_index.html +0 -2
- data/doc/fr_method_index.html +42 -41
- data/lib/extensions/object.rb +6 -0
- data/lib/utils/inflector.rb +2 -2
- data/test/extensions/object_test.rb +6 -4
- metadata +1 -3
- data/doc/classes/Mack.html +0 -111
- data/doc/classes/Mack/Utils.html +0 -111
data/doc/classes/Kernel.html
CHANGED
@@ -80,8 +80,8 @@
|
|
80
80
|
<h3 class="section-bar">Methods</h3>
|
81
81
|
|
82
82
|
<div class="name-list">
|
83
|
-
<a href="#
|
84
|
-
<a href="#
|
83
|
+
<a href="#M000063">pp_to_s</a>
|
84
|
+
<a href="#M000064">retryable</a>
|
85
85
|
</div>
|
86
86
|
</div>
|
87
87
|
|
@@ -103,19 +103,19 @@
|
|
103
103
|
<div id="methods">
|
104
104
|
<h3 class="section-bar">Public Class methods</h3>
|
105
105
|
|
106
|
-
<div id="method-
|
107
|
-
<a name="
|
106
|
+
<div id="method-M000063" class="method-detail">
|
107
|
+
<a name="M000063"></a>
|
108
108
|
|
109
109
|
<div class="method-heading">
|
110
|
-
<a href="#
|
110
|
+
<a href="#M000063" class="method-signature">
|
111
111
|
<span class="method-name">pp_to_s</span><span class="method-args">(object)</span>
|
112
112
|
</a>
|
113
113
|
</div>
|
114
114
|
|
115
115
|
<div class="method-description">
|
116
116
|
<p><a class="source-toggle" href="#"
|
117
|
-
onclick="toggleCode('
|
118
|
-
<div class="method-source-code" id="
|
117
|
+
onclick="toggleCode('M000063-source');return false;">[Source]</a></p>
|
118
|
+
<div class="method-source-code" id="M000063-source">
|
119
119
|
<pre>
|
120
120
|
<span class="ruby-comment cmt"># File lib/extensions/kernel.rb, line 6</span>
|
121
121
|
6: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">pp_to_s</span>(<span class="ruby-identifier">object</span>)
|
@@ -130,19 +130,19 @@
|
|
130
130
|
|
131
131
|
<h3 class="section-bar">Public Instance methods</h3>
|
132
132
|
|
133
|
-
<div id="method-
|
134
|
-
<a name="
|
133
|
+
<div id="method-M000064" class="method-detail">
|
134
|
+
<a name="M000064"></a>
|
135
135
|
|
136
136
|
<div class="method-heading">
|
137
|
-
<a href="#
|
137
|
+
<a href="#M000064" class="method-signature">
|
138
138
|
<span class="method-name">retryable</span><span class="method-args">(options = {}, &block)</span>
|
139
139
|
</a>
|
140
140
|
</div>
|
141
141
|
|
142
142
|
<div class="method-description">
|
143
143
|
<p><a class="source-toggle" href="#"
|
144
|
-
onclick="toggleCode('
|
145
|
-
<div class="method-source-code" id="
|
144
|
+
onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
|
145
|
+
<div class="method-source-code" id="M000064-source">
|
146
146
|
<pre>
|
147
147
|
<span class="ruby-comment cmt"># File lib/extensions/kernel.rb, line 12</span>
|
148
148
|
12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">retryable</span>(<span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
@@ -83,17 +83,17 @@
|
|
83
83
|
<div id="description">
|
84
84
|
<p>
|
85
85
|
This class is used to deal with inflection strings. This means taken a
|
86
|
-
string and make it <a href="Inflector.html#
|
87
|
-
href="Inflector.html#
|
86
|
+
string and make it <a href="Inflector.html#M000056">plural</a>, or <a
|
87
|
+
href="Inflector.html#M000057">singular</a>, etc… Inflection rules can
|
88
88
|
be added very easy, and are checked from the bottom up. This means that the
|
89
89
|
last rule is the first rule to be matched. The exception to this, kind of,
|
90
|
-
is ‘<a href="Inflector.html#
|
91
|
-
‘<a href="Inflector.html#
|
92
|
-
‘<a href="Inflector.html#
|
90
|
+
is ‘<a href="Inflector.html#M000058">irregular</a>’ and
|
91
|
+
‘<a href="Inflector.html#M000059">uncountable</a>’ rules. The
|
92
|
+
‘<a href="Inflector.html#M000059">uncountable</a>’ rules are
|
93
93
|
always checked first, then the ‘<a
|
94
|
-
href="Inflector.html#
|
95
|
-
either the ‘<a href="Inflector.html#
|
96
|
-
‘<a href="Inflector.html#
|
94
|
+
href="Inflector.html#M000058">irregular</a>’ rules, and finally
|
95
|
+
either the ‘<a href="Inflector.html#M000057">singular</a>’ or
|
96
|
+
‘<a href="Inflector.html#M000056">plural</a>’ rules, depending
|
97
97
|
on what you‘re trying to do. Within each of these sets of rules, the
|
98
98
|
last rule in is the first rule matched.
|
99
99
|
</p>
|
@@ -126,13 +126,13 @@ Example:
|
|
126
126
|
<h3 class="section-bar">Methods</h3>
|
127
127
|
|
128
128
|
<div class="name-list">
|
129
|
-
<a href="#
|
130
|
-
<a href="#
|
131
|
-
<a href="#
|
132
|
-
<a href="#
|
133
|
-
<a href="#
|
134
|
-
<a href="#
|
135
|
-
<a href="#
|
129
|
+
<a href="#M000062">inflections</a>
|
130
|
+
<a href="#M000058">irregular</a>
|
131
|
+
<a href="#M000056">plural</a>
|
132
|
+
<a href="#M000061">pluralize</a>
|
133
|
+
<a href="#M000057">singular</a>
|
134
|
+
<a href="#M000060">singularize</a>
|
135
|
+
<a href="#M000059">uncountable</a>
|
136
136
|
</div>
|
137
137
|
</div>
|
138
138
|
|
@@ -161,11 +161,11 @@ Example:
|
|
161
161
|
<div id="methods">
|
162
162
|
<h3 class="section-bar">Public Class methods</h3>
|
163
163
|
|
164
|
-
<div id="method-
|
165
|
-
<a name="
|
164
|
+
<div id="method-M000062" class="method-detail">
|
165
|
+
<a name="M000062"></a>
|
166
166
|
|
167
167
|
<div class="method-heading">
|
168
|
-
<a href="#
|
168
|
+
<a href="#M000062" class="method-signature">
|
169
169
|
<span class="method-name">inflections</span><span class="method-args">() {|Mack::Utils::Inflector.instance| ...}</span>
|
170
170
|
</a>
|
171
171
|
</div>
|
@@ -175,8 +175,8 @@ Example:
|
|
175
175
|
Yields up Mack::Utils::Inflector.instance
|
176
176
|
</p>
|
177
177
|
<p><a class="source-toggle" href="#"
|
178
|
-
onclick="toggleCode('
|
179
|
-
<div class="method-source-code" id="
|
178
|
+
onclick="toggleCode('M000062-source');return false;">[Source]</a></p>
|
179
|
+
<div class="method-source-code" id="M000062-source">
|
180
180
|
<pre>
|
181
181
|
<span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 121</span>
|
182
182
|
121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inflections</span>
|
@@ -189,18 +189,18 @@ Yields up Mack::Utils::Inflector.instance
|
|
189
189
|
|
190
190
|
<h3 class="section-bar">Public Instance methods</h3>
|
191
191
|
|
192
|
-
<div id="method-
|
193
|
-
<a name="
|
192
|
+
<div id="method-M000058" class="method-detail">
|
193
|
+
<a name="M000058"></a>
|
194
194
|
|
195
195
|
<div class="method-heading">
|
196
|
-
<a href="#
|
196
|
+
<a href="#M000058" class="method-signature">
|
197
197
|
<span class="method-name">irregular</span><span class="method-args">(rule, replacement)</span>
|
198
198
|
</a>
|
199
199
|
</div>
|
200
200
|
|
201
201
|
<div class="method-description">
|
202
202
|
<p>
|
203
|
-
Adds a <a href="Inflector.html#
|
203
|
+
Adds a <a href="Inflector.html#M000058">irregular</a> rule to the system.
|
204
204
|
</p>
|
205
205
|
<p>
|
206
206
|
Example:
|
@@ -212,8 +212,8 @@ Example:
|
|
212
212
|
end
|
213
213
|
</pre>
|
214
214
|
<p><a class="source-toggle" href="#"
|
215
|
-
onclick="toggleCode('
|
216
|
-
<div class="method-source-code" id="
|
215
|
+
onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
|
216
|
+
<div class="method-source-code" id="M000058-source">
|
217
217
|
<pre>
|
218
218
|
<span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 66</span>
|
219
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>)
|
@@ -228,18 +228,18 @@ Example:
|
|
228
228
|
</div>
|
229
229
|
</div>
|
230
230
|
|
231
|
-
<div id="method-
|
232
|
-
<a name="
|
231
|
+
<div id="method-M000056" class="method-detail">
|
232
|
+
<a name="M000056"></a>
|
233
233
|
|
234
234
|
<div class="method-heading">
|
235
|
-
<a href="#
|
235
|
+
<a href="#M000056" class="method-signature">
|
236
236
|
<span class="method-name">plural</span><span class="method-args">(rule, replacement)</span>
|
237
237
|
</a>
|
238
238
|
</div>
|
239
239
|
|
240
240
|
<div class="method-description">
|
241
241
|
<p>
|
242
|
-
Adds a <a href="Inflector.html#
|
242
|
+
Adds a <a href="Inflector.html#M000056">plural</a> rule to the system.
|
243
243
|
</p>
|
244
244
|
<p>
|
245
245
|
Example:
|
@@ -252,8 +252,8 @@ Example:
|
|
252
252
|
end
|
253
253
|
</pre>
|
254
254
|
<p><a class="source-toggle" href="#"
|
255
|
-
onclick="toggleCode('
|
256
|
-
<div class="method-source-code" id="
|
255
|
+
onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
|
256
|
+
<div class="method-source-code" id="M000056-source">
|
257
257
|
<pre>
|
258
258
|
<span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 43</span>
|
259
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>)
|
@@ -264,18 +264,18 @@ Example:
|
|
264
264
|
</div>
|
265
265
|
</div>
|
266
266
|
|
267
|
-
<div id="method-
|
268
|
-
<a name="
|
267
|
+
<div id="method-M000061" class="method-detail">
|
268
|
+
<a name="M000061"></a>
|
269
269
|
|
270
270
|
<div class="method-heading">
|
271
|
-
<a href="#
|
271
|
+
<a href="#M000061" class="method-signature">
|
272
272
|
<span class="method-name">pluralize</span><span class="method-args">(word)</span>
|
273
273
|
</a>
|
274
274
|
</div>
|
275
275
|
|
276
276
|
<div class="method-description">
|
277
277
|
<p>
|
278
|
-
Returns the <a href="Inflector.html#
|
278
|
+
Returns the <a href="Inflector.html#M000057">singular</a> version of the
|
279
279
|
word, if possible.
|
280
280
|
</p>
|
281
281
|
<p>
|
@@ -287,8 +287,8 @@ Examples:
|
|
287
287
|
Mack::Utils::Inflector.instance.pluralize("boat") # => "boats"
|
288
288
|
</pre>
|
289
289
|
<p><a class="source-toggle" href="#"
|
290
|
-
onclick="toggleCode('
|
291
|
-
<div class="method-source-code" id="
|
290
|
+
onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
|
291
|
+
<div class="method-source-code" id="M000061-source">
|
292
292
|
<pre>
|
293
293
|
<span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 102</span>
|
294
294
|
102: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pluralize</span>(<span class="ruby-identifier">word</span>)
|
@@ -299,18 +299,18 @@ Examples:
|
|
299
299
|
</div>
|
300
300
|
</div>
|
301
301
|
|
302
|
-
<div id="method-
|
303
|
-
<a name="
|
302
|
+
<div id="method-M000057" class="method-detail">
|
303
|
+
<a name="M000057"></a>
|
304
304
|
|
305
305
|
<div class="method-heading">
|
306
|
-
<a href="#
|
306
|
+
<a href="#M000057" class="method-signature">
|
307
307
|
<span class="method-name">singular</span><span class="method-args">(rule, replacement)</span>
|
308
308
|
</a>
|
309
309
|
</div>
|
310
310
|
|
311
311
|
<div class="method-description">
|
312
312
|
<p>
|
313
|
-
Adds a <a href="Inflector.html#
|
313
|
+
Adds a <a href="Inflector.html#M000057">singular</a> rule to the system.
|
314
314
|
</p>
|
315
315
|
<p>
|
316
316
|
Example:
|
@@ -323,8 +323,8 @@ Example:
|
|
323
323
|
end
|
324
324
|
</pre>
|
325
325
|
<p><a class="source-toggle" href="#"
|
326
|
-
onclick="toggleCode('
|
327
|
-
<div class="method-source-code" id="
|
326
|
+
onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
|
327
|
+
<div class="method-source-code" id="M000057-source">
|
328
328
|
<pre>
|
329
329
|
<span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 55</span>
|
330
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>)
|
@@ -335,18 +335,18 @@ Example:
|
|
335
335
|
</div>
|
336
336
|
</div>
|
337
337
|
|
338
|
-
<div id="method-
|
339
|
-
<a name="
|
338
|
+
<div id="method-M000060" class="method-detail">
|
339
|
+
<a name="M000060"></a>
|
340
340
|
|
341
341
|
<div class="method-heading">
|
342
|
-
<a href="#
|
342
|
+
<a href="#M000060" class="method-signature">
|
343
343
|
<span class="method-name">singularize</span><span class="method-args">(word)</span>
|
344
344
|
</a>
|
345
345
|
</div>
|
346
346
|
|
347
347
|
<div class="method-description">
|
348
348
|
<p>
|
349
|
-
Returns the <a href="Inflector.html#
|
349
|
+
Returns the <a href="Inflector.html#M000057">singular</a> version of the
|
350
350
|
word, if possible.
|
351
351
|
</p>
|
352
352
|
<p>
|
@@ -358,8 +358,8 @@ Examples:
|
|
358
358
|
Mack::Utils::Inflector.instance.singularize("boats") # => "boat"
|
359
359
|
</pre>
|
360
360
|
<p><a class="source-toggle" href="#"
|
361
|
-
onclick="toggleCode('
|
362
|
-
<div class="method-source-code" id="
|
361
|
+
onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
|
362
|
+
<div class="method-source-code" id="M000060-source">
|
363
363
|
<pre>
|
364
364
|
<span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 92</span>
|
365
365
|
92: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">singularize</span>(<span class="ruby-identifier">word</span>)
|
@@ -370,18 +370,18 @@ Examples:
|
|
370
370
|
</div>
|
371
371
|
</div>
|
372
372
|
|
373
|
-
<div id="method-
|
374
|
-
<a name="
|
373
|
+
<div id="method-M000059" class="method-detail">
|
374
|
+
<a name="M000059"></a>
|
375
375
|
|
376
376
|
<div class="method-heading">
|
377
|
-
<a href="#
|
377
|
+
<a href="#M000059" class="method-signature">
|
378
378
|
<span class="method-name">uncountable</span><span class="method-args">(*args)</span>
|
379
379
|
</a>
|
380
380
|
</div>
|
381
381
|
|
382
382
|
<div class="method-description">
|
383
383
|
<p>
|
384
|
-
Adds a <a href="Inflector.html#
|
384
|
+
Adds a <a href="Inflector.html#M000059">uncountable</a> word, or words, to
|
385
385
|
the system.
|
386
386
|
</p>
|
387
387
|
<p>
|
@@ -393,8 +393,8 @@ Example:
|
|
393
393
|
end
|
394
394
|
</pre>
|
395
395
|
<p><a class="source-toggle" href="#"
|
396
|
-
onclick="toggleCode('
|
397
|
-
<div class="method-source-code" id="
|
396
|
+
onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
|
397
|
+
<div class="method-source-code" id="M000059-source">
|
398
398
|
<pre>
|
399
399
|
<span class="ruby-comment cmt"># File lib/utils/inflector.rb, line 80</span>
|
400
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>)
|
data/doc/classes/Math.html
CHANGED
@@ -80,9 +80,9 @@
|
|
80
80
|
<h3 class="section-bar">Methods</h3>
|
81
81
|
|
82
82
|
<div class="name-list">
|
83
|
-
<a href="#
|
84
|
-
<a href="#
|
85
|
-
<a href="#
|
83
|
+
<a href="#M000065">log2</a>
|
84
|
+
<a href="#M000067">max</a>
|
85
|
+
<a href="#M000066">min</a>
|
86
86
|
</div>
|
87
87
|
</div>
|
88
88
|
|
@@ -104,19 +104,19 @@
|
|
104
104
|
<div id="methods">
|
105
105
|
<h3 class="section-bar">Public Class methods</h3>
|
106
106
|
|
107
|
-
<div id="method-
|
108
|
-
<a name="
|
107
|
+
<div id="method-M000065" class="method-detail">
|
108
|
+
<a name="M000065"></a>
|
109
109
|
|
110
110
|
<div class="method-heading">
|
111
|
-
<a href="#
|
111
|
+
<a href="#M000065" class="method-signature">
|
112
112
|
<span class="method-name">log2</span><span class="method-args">(x)</span>
|
113
113
|
</a>
|
114
114
|
</div>
|
115
115
|
|
116
116
|
<div class="method-description">
|
117
117
|
<p><a class="source-toggle" href="#"
|
118
|
-
onclick="toggleCode('
|
119
|
-
<div class="method-source-code" id="
|
118
|
+
onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
|
119
|
+
<div class="method-source-code" id="M000065-source">
|
120
120
|
<pre>
|
121
121
|
<span class="ruby-comment cmt"># File lib/extensions/math.rb, line 3</span>
|
122
122
|
3: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">log2</span>(<span class="ruby-identifier">x</span>)
|
@@ -127,19 +127,19 @@
|
|
127
127
|
</div>
|
128
128
|
</div>
|
129
129
|
|
130
|
-
<div id="method-
|
131
|
-
<a name="
|
130
|
+
<div id="method-M000067" class="method-detail">
|
131
|
+
<a name="M000067"></a>
|
132
132
|
|
133
133
|
<div class="method-heading">
|
134
|
-
<a href="#
|
134
|
+
<a href="#M000067" class="method-signature">
|
135
135
|
<span class="method-name">max</span><span class="method-args">(a, b)</span>
|
136
136
|
</a>
|
137
137
|
</div>
|
138
138
|
|
139
139
|
<div class="method-description">
|
140
140
|
<p><a class="source-toggle" href="#"
|
141
|
-
onclick="toggleCode('
|
142
|
-
<div class="method-source-code" id="
|
141
|
+
onclick="toggleCode('M000067-source');return false;">[Source]</a></p>
|
142
|
+
<div class="method-source-code" id="M000067-source">
|
143
143
|
<pre>
|
144
144
|
<span class="ruby-comment cmt"># File lib/extensions/math.rb, line 11</span>
|
145
145
|
11: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">max</span>(<span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span>)
|
@@ -150,19 +150,19 @@
|
|
150
150
|
</div>
|
151
151
|
</div>
|
152
152
|
|
153
|
-
<div id="method-
|
154
|
-
<a name="
|
153
|
+
<div id="method-M000066" class="method-detail">
|
154
|
+
<a name="M000066"></a>
|
155
155
|
|
156
156
|
<div class="method-heading">
|
157
|
-
<a href="#
|
157
|
+
<a href="#M000066" class="method-signature">
|
158
158
|
<span class="method-name">min</span><span class="method-args">(a, b)</span>
|
159
159
|
</a>
|
160
160
|
</div>
|
161
161
|
|
162
162
|
<div class="method-description">
|
163
163
|
<p><a class="source-toggle" href="#"
|
164
|
-
onclick="toggleCode('
|
165
|
-
<div class="method-source-code" id="
|
164
|
+
onclick="toggleCode('M000066-source');return false;">[Source]</a></p>
|
165
|
+
<div class="method-source-code" id="M000066-source">
|
166
166
|
<pre>
|
167
167
|
<span class="ruby-comment cmt"># File lib/extensions/math.rb, line 7</span>
|
168
168
|
7: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">min</span>(<span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span>)
|
data/doc/classes/Object.html
CHANGED
@@ -88,11 +88,12 @@
|
|
88
88
|
<h3 class="section-bar">Methods</h3>
|
89
89
|
|
90
90
|
<div class="name-list">
|
91
|
-
<a href="#
|
92
|
-
<a href="#
|
93
|
-
<a href="#
|
94
|
-
<a href="#M000026">
|
95
|
-
<a href="#M000027">
|
91
|
+
<a href="#M000029">ivar_cache</a>
|
92
|
+
<a href="#M000030">ivar_cache_clear</a>
|
93
|
+
<a href="#M000031">namespaces</a>
|
94
|
+
<a href="#M000026">needs_method</a>
|
95
|
+
<a href="#M000027">running_time</a>
|
96
|
+
<a href="#M000028">send_with_chain</a>
|
96
97
|
<a href="#M000025">to_param</a>
|
97
98
|
</div>
|
98
99
|
</div>
|
@@ -113,45 +114,41 @@
|
|
113
114
|
|
114
115
|
<!-- if method_list -->
|
115
116
|
<div id="methods">
|
116
|
-
<h3 class="section-bar">Public
|
117
|
+
<h3 class="section-bar">Public Class methods</h3>
|
117
118
|
|
118
|
-
<div id="method-
|
119
|
-
<a name="
|
119
|
+
<div id="method-M000026" class="method-detail">
|
120
|
+
<a name="M000026"></a>
|
120
121
|
|
121
122
|
<div class="method-heading">
|
122
|
-
<a href="#
|
123
|
-
<span class="method-name">
|
123
|
+
<a href="#M000026" class="method-signature">
|
124
|
+
<span class="method-name">needs_method</span><span class="method-args">(meth)</span>
|
124
125
|
</a>
|
125
126
|
</div>
|
126
127
|
|
127
128
|
<div class="method-description">
|
128
129
|
<p><a class="source-toggle" href="#"
|
129
|
-
onclick="toggleCode('
|
130
|
-
<div class="method-source-code" id="
|
130
|
+
onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
|
131
|
+
<div class="method-source-code" id="M000026-source">
|
131
132
|
<pre>
|
132
|
-
<span class="ruby-comment cmt"># File lib/extensions/object.rb, line
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
74: <span class="ruby-identifier">var</span> = <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-node">"@#{var_name}"</span>)
|
139
|
-
75: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">var</span>
|
140
|
-
76: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">"@#{var_name}"</span>, <span class="ruby-keyword kw">yield</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
141
|
-
77: <span class="ruby-keyword kw">end</span>
|
142
|
-
78: <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-node">"@#{var_name}"</span>)
|
143
|
-
79: <span class="ruby-keyword kw">end</span>
|
133
|
+
<span class="ruby-comment cmt"># File lib/extensions/object.rb, line 9</span>
|
134
|
+
9: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">needs_method</span>(<span class="ruby-identifier">meth</span>)
|
135
|
+
10: <span class="ruby-identifier">define_method</span>(<span class="ruby-identifier">meth</span>) <span class="ruby-keyword kw">do</span>
|
136
|
+
11: <span class="ruby-identifier">raise</span> <span class="ruby-constant">MethodNotImplemented</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">meth</span>)
|
137
|
+
12: <span class="ruby-keyword kw">end</span>
|
138
|
+
13: <span class="ruby-keyword kw">end</span>
|
144
139
|
</pre>
|
145
140
|
</div>
|
146
141
|
</div>
|
147
142
|
</div>
|
148
143
|
|
144
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
145
|
+
|
149
146
|
<div id="method-M000029" class="method-detail">
|
150
147
|
<a name="M000029"></a>
|
151
148
|
|
152
149
|
<div class="method-heading">
|
153
150
|
<a href="#M000029" class="method-signature">
|
154
|
-
<span class="method-name">
|
151
|
+
<span class="method-name">ivar_cache</span><span class="method-args">(var_name = nil) {|| ...}</span>
|
155
152
|
</a>
|
156
153
|
</div>
|
157
154
|
|
@@ -160,15 +157,18 @@
|
|
160
157
|
onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
|
161
158
|
<div class="method-source-code" id="M000029-source">
|
162
159
|
<pre>
|
163
|
-
<span class="ruby-comment cmt"># File lib/extensions/object.rb, line
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
160
|
+
<span class="ruby-comment cmt"># File lib/extensions/object.rb, line 75</span>
|
161
|
+
75: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ivar_cache</span>(<span class="ruby-identifier">var_name</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
162
|
+
76: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">var_name</span>.<span class="ruby-identifier">nil?</span>
|
163
|
+
77: <span class="ruby-identifier">call</span> = <span class="ruby-identifier">caller</span>[<span class="ruby-value">0</span>]
|
164
|
+
78: <span class="ruby-identifier">var_name</span> = <span class="ruby-identifier">call</span>[(<span class="ruby-identifier">call</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">'`'</span>)<span class="ruby-operator">+</span><span class="ruby-value">1</span>)<span class="ruby-operator">...</span><span class="ruby-identifier">call</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">"'"</span>)]
|
165
|
+
79: <span class="ruby-keyword kw">end</span>
|
166
|
+
80: <span class="ruby-identifier">var</span> = <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-node">"@#{var_name}"</span>)
|
167
|
+
81: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">var</span>
|
168
|
+
82: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">"@#{var_name}"</span>, <span class="ruby-keyword kw">yield</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
169
|
+
83: <span class="ruby-keyword kw">end</span>
|
170
|
+
84: <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-node">"@#{var_name}"</span>)
|
171
|
+
85: <span class="ruby-keyword kw">end</span>
|
172
172
|
</pre>
|
173
173
|
</div>
|
174
174
|
</div>
|
@@ -179,7 +179,7 @@
|
|
179
179
|
|
180
180
|
<div class="method-heading">
|
181
181
|
<a href="#M000030" class="method-signature">
|
182
|
-
<span class="method-name">
|
182
|
+
<span class="method-name">ivar_cache_clear</span><span class="method-args">(var_name = nil) {|if block_given?| ...}</span>
|
183
183
|
</a>
|
184
184
|
</div>
|
185
185
|
|
@@ -188,59 +188,47 @@
|
|
188
188
|
onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
|
189
189
|
<div class="method-source-code" id="M000030-source">
|
190
190
|
<pre>
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
98: <span class="ruby-identifier">nss</span>.<span class="ruby-identifier">pop</span>
|
201
|
-
99: <span class="ruby-identifier">nss</span>
|
202
|
-
100: <span class="ruby-keyword kw">end</span>
|
203
|
-
101: <span class="ruby-keyword kw">end</span>
|
191
|
+
<span class="ruby-comment cmt"># File lib/extensions/object.rb, line 87</span>
|
192
|
+
87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ivar_cache_clear</span>(<span class="ruby-identifier">var_name</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
193
|
+
88: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">var_name</span>.<span class="ruby-identifier">nil?</span>
|
194
|
+
89: <span class="ruby-identifier">call</span> = <span class="ruby-identifier">caller</span>[<span class="ruby-value">0</span>]
|
195
|
+
90: <span class="ruby-identifier">var_name</span> = <span class="ruby-identifier">call</span>[(<span class="ruby-identifier">call</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">'`'</span>)<span class="ruby-operator">+</span><span class="ruby-value">1</span>)<span class="ruby-operator">...</span><span class="ruby-identifier">call</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">"'"</span>)]
|
196
|
+
91: <span class="ruby-keyword kw">end</span>
|
197
|
+
92: <span class="ruby-identifier">remove_instance_variable</span>(<span class="ruby-node">"@#{var_name}"</span>) <span class="ruby-keyword kw">rescue</span>
|
198
|
+
93: <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
199
|
+
94: <span class="ruby-keyword kw">end</span>
|
204
200
|
</pre>
|
205
201
|
</div>
|
206
202
|
</div>
|
207
203
|
</div>
|
208
204
|
|
209
|
-
<div id="method-
|
210
|
-
<a name="
|
205
|
+
<div id="method-M000031" class="method-detail">
|
206
|
+
<a name="M000031"></a>
|
211
207
|
|
212
208
|
<div class="method-heading">
|
213
|
-
<a href="#
|
214
|
-
<span class="method-name">
|
209
|
+
<a href="#M000031" class="method-signature">
|
210
|
+
<span class="method-name">namespaces</span><span class="method-args">()</span>
|
215
211
|
</a>
|
216
212
|
</div>
|
217
213
|
|
218
214
|
<div class="method-description">
|
219
215
|
<p><a class="source-toggle" href="#"
|
220
|
-
onclick="toggleCode('
|
221
|
-
<div class="method-source-code" id="
|
216
|
+
onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
|
217
|
+
<div class="method-source-code" id="M000031-source">
|
222
218
|
<pre>
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
21: <span class="ruby-identifier">x</span> = <span class="ruby-node">"Running time #{secs} seconds."</span>
|
237
|
-
22: <span class="ruby-keyword kw">else</span>
|
238
|
-
23: <span class="ruby-identifier">x</span> = <span class="ruby-node">"Running time roughly #{secs/60} minutes [#{secs} seconds]"</span>
|
239
|
-
24: <span class="ruby-keyword kw">end</span>
|
240
|
-
25: <span class="ruby-identifier">x</span> <span class="ruby-operator">+=</span> <span class="ruby-node">" [MESSAGE]: #{message}"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">blank?</span>
|
241
|
-
26: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">x</span>
|
242
|
-
27: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span> <span class="ruby-identifier">x</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">nil?</span>
|
243
|
-
28: <span class="ruby-keyword kw">end</span>
|
219
|
+
<span class="ruby-comment cmt"># File lib/extensions/object.rb, line 96</span>
|
220
|
+
96: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">namespaces</span>
|
221
|
+
97: <span class="ruby-identifier">ivar_cache</span>(<span class="ruby-value str">"object_namespaces"</span>) <span class="ruby-keyword kw">do</span>
|
222
|
+
98: <span class="ruby-identifier">nss</span> = []
|
223
|
+
99: <span class="ruby-identifier">full_name</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>
|
224
|
+
100: <span class="ruby-identifier">ns</span> = <span class="ruby-identifier">full_name</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">"::"</span>)
|
225
|
+
101: <span class="ruby-identifier">ns</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span>
|
226
|
+
102: <span class="ruby-identifier">nss</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">n</span>
|
227
|
+
103: <span class="ruby-keyword kw">end</span>
|
228
|
+
104: <span class="ruby-identifier">nss</span>.<span class="ruby-identifier">pop</span>
|
229
|
+
105: <span class="ruby-identifier">nss</span>
|
230
|
+
106: <span class="ruby-keyword kw">end</span>
|
231
|
+
107: <span class="ruby-keyword kw">end</span>
|
244
232
|
</pre>
|
245
233
|
</div>
|
246
234
|
</div>
|
@@ -251,7 +239,7 @@
|
|
251
239
|
|
252
240
|
<div class="method-heading">
|
253
241
|
<a href="#M000027" class="method-signature">
|
254
|
-
<span class="method-name">
|
242
|
+
<span class="method-name">running_time</span><span class="method-args">(message = "", logger = nil) {|if block_given?| ...}</span>
|
255
243
|
</a>
|
256
244
|
</div>
|
257
245
|
|
@@ -260,13 +248,53 @@
|
|
260
248
|
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
|
261
249
|
<div class="method-source-code" id="M000027-source">
|
262
250
|
<pre>
|
263
|
-
<span class="ruby-comment cmt"># File lib/extensions/object.rb, line
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
251
|
+
<span class="ruby-comment cmt"># File lib/extensions/object.rb, line 15</span>
|
252
|
+
15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">running_time</span>(<span class="ruby-identifier">message</span> = <span class="ruby-value str">""</span>, <span class="ruby-identifier">logger</span> = <span class="ruby-keyword kw">nil</span>)
|
253
|
+
16: <span class="ruby-identifier">s_time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
254
|
+
17: <span class="ruby-identifier">s</span> = <span class="ruby-node">"---Starting at #{s_time}---"</span>
|
255
|
+
18: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">s</span>
|
256
|
+
19: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span> <span class="ruby-identifier">s</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">nil?</span>
|
257
|
+
20: <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
258
|
+
21: <span class="ruby-identifier">e_time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
259
|
+
22: <span class="ruby-identifier">e</span> = <span class="ruby-node">"---Ending at #{e_time}---"</span>
|
260
|
+
23: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>
|
261
|
+
24: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span> <span class="ruby-identifier">e</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">nil?</span>
|
262
|
+
25: <span class="ruby-identifier">secs</span> = <span class="ruby-identifier">e_time</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">s_time</span>
|
263
|
+
26: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">secs</span> <span class="ruby-operator"><</span> <span class="ruby-value">60</span>
|
264
|
+
27: <span class="ruby-identifier">x</span> = <span class="ruby-node">"Running time #{secs} seconds."</span>
|
265
|
+
28: <span class="ruby-keyword kw">else</span>
|
266
|
+
29: <span class="ruby-identifier">x</span> = <span class="ruby-node">"Running time roughly #{secs/60} minutes [#{secs} seconds]"</span>
|
267
|
+
30: <span class="ruby-keyword kw">end</span>
|
268
|
+
31: <span class="ruby-identifier">x</span> <span class="ruby-operator">+=</span> <span class="ruby-node">" [MESSAGE]: #{message}"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">blank?</span>
|
269
|
+
32: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">x</span>
|
270
|
+
33: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span> <span class="ruby-identifier">x</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">nil?</span>
|
271
|
+
34: <span class="ruby-keyword kw">end</span>
|
272
|
+
</pre>
|
273
|
+
</div>
|
274
|
+
</div>
|
275
|
+
</div>
|
276
|
+
|
277
|
+
<div id="method-M000028" class="method-detail">
|
278
|
+
<a name="M000028"></a>
|
279
|
+
|
280
|
+
<div class="method-heading">
|
281
|
+
<a href="#M000028" class="method-signature">
|
282
|
+
<span class="method-name">send_with_chain</span><span class="method-args">(methods, *args)</span>
|
283
|
+
</a>
|
284
|
+
</div>
|
285
|
+
|
286
|
+
<div class="method-description">
|
287
|
+
<p><a class="source-toggle" href="#"
|
288
|
+
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
|
289
|
+
<div class="method-source-code" id="M000028-source">
|
290
|
+
<pre>
|
291
|
+
<span class="ruby-comment cmt"># File lib/extensions/object.rb, line 36</span>
|
292
|
+
36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_with_chain</span>(<span class="ruby-identifier">methods</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
293
|
+
37: <span class="ruby-identifier">obj</span> = <span class="ruby-keyword kw">self</span>
|
294
|
+
38: <span class="ruby-identifier">methods</span> = [<span class="ruby-identifier">methods</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
|
295
|
+
39: <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">obj</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">m</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)}
|
296
|
+
40: <span class="ruby-identifier">obj</span>
|
297
|
+
41: <span class="ruby-keyword kw">end</span>
|
270
298
|
</pre>
|
271
299
|
</div>
|
272
300
|
</div>
|