lazier 3.3.10 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 823adba65d6ca77ff56038eb88fb3ca5b565aba6
4
- data.tar.gz: 18bfaceeddb8567e7a25e9e2367ca124abc340bd
3
+ metadata.gz: c406074bef8ec89c6386eaa1b1ee8dd37641d2f6
4
+ data.tar.gz: 33c02bb14c9cf848034ebe78fb7853b90b8555d2
5
5
  SHA512:
6
- metadata.gz: 2a549517a8f261b2ff952b331552e961e1e04fe1e5712ed29867dd4e88bc2bf0bee08a93ea368b56097b18841c46c77ec32f70fa31a5544340bc1db2481c24a6
7
- data.tar.gz: b15c32d9610989975d54b864f460961a539ae75b92b56d6db76507517788d5135f8c66308f6b63d64311aba1f36efe3e24b5129dc311d0451461880a3f8fde3d
6
+ metadata.gz: 20304d18773f4b926834cbcee80a377c14aaf7a99dc0bd9fc7b362b424910200a68e88da9014a4b1678c1373926de7aab81fec44b7f467528a6cfcd54bfe3341
7
+ data.tar.gz: 3504a324c3a480db9c9ad0dc8f309eef5d0419d774367c6b8069d184a06bfca34892401044c57b164595b82aff6a017687583268a2c52dcae1798f7378278c12
@@ -10,6 +10,6 @@ gemspec
10
10
 
11
11
  # Testing
12
12
  gem "rspec", "~> 2.14.1"
13
- gem "rake", "~> 10.1.0"
14
- gem "simplecov", ">= 0.7.1"
15
- gem "coveralls", ">= 0.6.7", require: false
13
+ gem "rake", "~> 10.1.1"
14
+ gem "simplecov", ">= 0.8.2"
15
+ gem "coveralls", ">= 0.7.0", require: false
@@ -1,3 +1,9 @@
1
+ ### 3.4.0 / 2014-01-25
2
+
3
+ * Added dotted notation access for Hashes. See: `Lazier::Hash#enable_dotted_access`.
4
+ * Added `Lazier::Hash#compact` and `Lazier::Hash#compact!`.
5
+ * Added `Lazier::Object#safe_send`.
6
+
1
7
  ### 3.3.10 / 2013-12-02
2
8
 
3
9
  * Fixed boolean conversion.
data/Gemfile CHANGED
@@ -13,9 +13,9 @@ gem "rspec", "~> 2.14.1"
13
13
  gem "rake", "~> 10.1.0"
14
14
 
15
15
  # Documentation
16
- gem "simplecov", ">= 0.7.1"
17
- gem "coveralls", ">= 0.6.7", require: false
16
+ gem "simplecov", ">= 0.8.2"
17
+ gem "coveralls", ">= 0.7.0", require: false
18
18
  gem "pry", ">= 0"
19
19
  gem "yard", ">= 0.8.7"
20
- gem "kramdown", ">= 1.1.0"
21
- gem "github-markup", ">= 0.7.5"
20
+ gem "kramdown", ">= 1.3.1"
21
+ gem "github-markup", ">= 1.0.0"
@@ -1166,9 +1166,9 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
1166
1166
  </div>
1167
1167
 
1168
1168
  <div id="footer">
1169
- Generated on Mon Dec 2 15:35:20 2013 by
1169
+ Generated on Sat Jan 25 11:01:53 2014 by
1170
1170
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1171
- 0.8.7.3 (ruby-2.0.0).
1171
+ 0.8.7.3 (ruby-2.1.0).
1172
1172
  </div>
1173
1173
 
1174
1174
  </body>
@@ -288,9 +288,9 @@
288
288
  </div>
289
289
 
290
290
  <div id="footer">
291
- Generated on Mon Dec 2 15:35:20 2013 by
291
+ Generated on Sat Jan 25 11:01:53 2014 by
292
292
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
293
- 0.8.7.3 (ruby-2.0.0).
293
+ 0.8.7.3 (ruby-2.1.0).
294
294
  </div>
295
295
 
296
296
  </body>
@@ -386,9 +386,9 @@ Options are as follows:</p>
386
386
  </div>
387
387
 
388
388
  <div id="footer">
389
- Generated on Mon Dec 2 15:35:21 2013 by
389
+ Generated on Sat Jan 25 11:01:54 2014 by
390
390
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
391
- 0.8.7.3 (ruby-2.0.0).
391
+ 0.8.7.3 (ruby-2.1.0).
392
392
  </div>
393
393
 
394
394
  </body>
@@ -721,9 +721,9 @@ DateTime.civil(2013, 6, 1).in_months(2011)
721
721
  </div>
722
722
 
723
723
  <div id="footer">
724
- Generated on Mon Dec 2 15:35:20 2013 by
724
+ Generated on Sat Jan 25 11:01:54 2014 by
725
725
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
726
- 0.8.7.3 (ruby-2.0.0).
726
+ 0.8.7.3 (ruby-2.1.0).
727
727
  </div>
728
728
 
729
729
  </body>
@@ -1542,9 +1542,9 @@ Date.years(1, true, 2010, true)
1542
1542
  </div>
1543
1543
 
1544
1544
  <div id="footer">
1545
- Generated on Mon Dec 2 15:35:20 2013 by
1545
+ Generated on Sat Jan 25 11:01:54 2014 by
1546
1546
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1547
- 0.8.7.3 (ruby-2.0.0).
1547
+ 0.8.7.3 (ruby-2.1.0).
1548
1548
  </div>
1549
1549
 
1550
1550
  </body>
@@ -116,9 +116,9 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Mon Dec 2 15:35:21 2013 by
119
+ Generated on Sat Jan 25 11:01:54 2014 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
- 0.8.7.3 (ruby-2.0.0).
121
+ 0.8.7.3 (ruby-2.1.0).
122
122
  </div>
123
123
 
124
124
  </body>
@@ -124,9 +124,9 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Mon Dec 2 15:35:21 2013 by
127
+ Generated on Sat Jan 25 11:01:54 2014 by
128
128
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
- 0.8.7.3 (ruby-2.0.0).
129
+ 0.8.7.3 (ruby-2.1.0).
130
130
  </div>
131
131
 
132
132
  </body>
@@ -238,9 +238,9 @@
238
238
  </div>
239
239
 
240
240
  <div id="footer">
241
- Generated on Mon Dec 2 15:35:21 2013 by
241
+ Generated on Sat Jan 25 11:01:54 2014 by
242
242
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
243
- 0.8.7.3 (ruby-2.0.0).
243
+ 0.8.7.3 (ruby-2.1.0).
244
244
  </div>
245
245
 
246
246
  </body>
@@ -116,6 +116,75 @@
116
116
  <li class="public ">
117
117
  <span class="summary_signature">
118
118
 
119
+ <a href="#compact-instance_method" title="#compact (instance method)">- (Hash) <strong>compact</strong>(&amp;validator) </a>
120
+
121
+
122
+
123
+ </span>
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+ <span class="summary_desc"><div class='inline'><p>Returns a new hash, removing all keys which values are blank.</p>
134
+ </div></span>
135
+
136
+ </li>
137
+
138
+
139
+ <li class="public ">
140
+ <span class="summary_signature">
141
+
142
+ <a href="#compact%21-instance_method" title="#compact! (instance method)">- (Object) <strong>compact!</strong>(&amp;validator) </a>
143
+
144
+
145
+
146
+ </span>
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+ <span class="summary_desc"><div class='inline'><p>Compacts the current hash, removing all keys which values are blank.</p>
157
+ </div></span>
158
+
159
+ </li>
160
+
161
+
162
+ <li class="public ">
163
+ <span class="summary_signature">
164
+
165
+ <a href="#enable_dotted_access-instance_method" title="#enable_dotted_access (instance method)">- (Object) <strong>enable_dotted_access</strong>(readonly = true) </a>
166
+
167
+
168
+
169
+ </span>
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+ <span class="summary_desc"><div class='inline'><p>Makes sure that the hash is accessible using dotted notation.</p>
180
+ </div></span>
181
+
182
+ </li>
183
+
184
+
185
+ <li class="public ">
186
+ <span class="summary_signature">
187
+
119
188
  <a href="#ensure_access-instance_method" title="#ensure_access (instance method)">- (Object) <strong>ensure_access</strong>(access) </a>
120
189
 
121
190
 
@@ -147,7 +216,231 @@
147
216
 
148
217
 
149
218
  <div class="method_details first">
150
- <h3 class="signature first" id="ensure_access-instance_method">
219
+ <h3 class="signature first" id="compact-instance_method">
220
+
221
+ - (<tt><span class='object_link'><a href="" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>compact</strong>(&amp;validator)
222
+
223
+
224
+
225
+
226
+
227
+ </h3><div class="docstring">
228
+ <div class="discussion">
229
+ <p>Returns a new hash, removing all keys which values are blank.</p>
230
+
231
+
232
+ </div>
233
+ </div>
234
+ <div class="tags">
235
+ <p class="tag_title">Parameters:</p>
236
+ <ul class="param">
237
+
238
+ <li>
239
+
240
+ <span class='name'>validator</span>
241
+
242
+
243
+ <span class='type'>(<tt>Proc</tt>)</span>
244
+
245
+
246
+
247
+ &mdash;
248
+ <div class='inline'><p>, if present all the keys which evaluates to true will be removed. Otherwise all blank values will be removed.</p>
249
+ </div>
250
+
251
+ </li>
252
+
253
+ </ul>
254
+
255
+ <p class="tag_title">Returns:</p>
256
+ <ul class="return">
257
+
258
+ <li>
259
+
260
+
261
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Lazier::Hash (module)">Hash</a></span></tt>)</span>
262
+
263
+
264
+
265
+ &mdash;
266
+ <div class='inline'><p>The hash with all blank values removed.</p>
267
+ </div>
268
+
269
+ </li>
270
+
271
+ </ul>
272
+
273
+ </div><table class="source_code">
274
+ <tr>
275
+ <td>
276
+ <pre class="lines">
277
+
278
+
279
+ 16
280
+ 17
281
+ 18
282
+ 19</pre>
283
+ </td>
284
+ <td>
285
+ <pre class="code"><span class="info file"># File 'lib/lazier/hash.rb', line 16</span>
286
+
287
+ <span class='kw'>def</span> <span class='id identifier rubyid_compact'>compact</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_validator'>validator</span><span class='rparen'>)</span>
288
+ <span class='id identifier rubyid_validator'>validator</span> <span class='op'>||=</span> <span class='tlambda'>-&gt;</span><span class='lparen'>(</span><span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='rbrace'>}</span>
289
+ <span class='id identifier rubyid_reject'>reject</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_validator'>validator</span><span class='rparen'>)</span>
290
+ <span class='kw'>end</span></pre>
291
+ </td>
292
+ </tr>
293
+ </table>
294
+ </div>
295
+
296
+ <div class="method_details ">
297
+ <h3 class="signature " id="compact!-instance_method">
298
+
299
+ - (<tt><span class='object_link'><a href="Object.html" title="Lazier::Object (module)">Object</a></span></tt>) <strong>compact!</strong>(&amp;validator)
300
+
301
+
302
+
303
+
304
+
305
+ </h3><div class="docstring">
306
+ <div class="discussion">
307
+ <p>Compacts the current hash, removing all keys which values are blank.</p>
308
+
309
+
310
+ </div>
311
+ </div>
312
+ <div class="tags">
313
+ <p class="tag_title">Parameters:</p>
314
+ <ul class="param">
315
+
316
+ <li>
317
+
318
+ <span class='name'>validator</span>
319
+
320
+
321
+ <span class='type'>(<tt>Proc</tt>)</span>
322
+
323
+
324
+
325
+ &mdash;
326
+ <div class='inline'><p>, if present all the keys which evaluates to true will be removed. Otherwise all blank values will be removed.</p>
327
+ </div>
328
+
329
+ </li>
330
+
331
+ </ul>
332
+
333
+
334
+ </div><table class="source_code">
335
+ <tr>
336
+ <td>
337
+ <pre class="lines">
338
+
339
+
340
+ 24
341
+ 25
342
+ 26
343
+ 27</pre>
344
+ </td>
345
+ <td>
346
+ <pre class="code"><span class="info file"># File 'lib/lazier/hash.rb', line 24</span>
347
+
348
+ <span class='kw'>def</span> <span class='id identifier rubyid_compact!'>compact!</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_validator'>validator</span><span class='rparen'>)</span>
349
+ <span class='id identifier rubyid_validator'>validator</span> <span class='op'>||=</span> <span class='tlambda'>-&gt;</span><span class='lparen'>(</span><span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='rbrace'>}</span>
350
+ <span class='id identifier rubyid_reject!'>reject!</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_validator'>validator</span><span class='rparen'>)</span>
351
+ <span class='kw'>end</span></pre>
352
+ </td>
353
+ </tr>
354
+ </table>
355
+ </div>
356
+
357
+ <div class="method_details ">
358
+ <h3 class="signature " id="enable_dotted_access-instance_method">
359
+
360
+ - (<tt><span class='object_link'><a href="Object.html" title="Lazier::Object (module)">Object</a></span></tt>) <strong>enable_dotted_access</strong>(readonly = true)
361
+
362
+
363
+
364
+
365
+
366
+ </h3><div class="docstring">
367
+ <div class="discussion">
368
+ <p>Makes sure that the hash is accessible using dotted notation. This is also applied to every embedded hash.</p>
369
+
370
+
371
+ </div>
372
+ </div>
373
+ <div class="tags">
374
+ <p class="tag_title">Parameters:</p>
375
+ <ul class="param">
376
+
377
+ <li>
378
+
379
+ <span class='name'>readonly</span>
380
+
381
+
382
+ <span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
383
+
384
+
385
+ <em class="default">(defaults to: <tt>true</tt>)</em>
386
+
387
+
388
+ &mdash;
389
+ <div class='inline'><p>If the dotted notation is only enable for reading. <code>true</code> by default.</p>
390
+ </div>
391
+
392
+ </li>
393
+
394
+ </ul>
395
+
396
+
397
+ </div><table class="source_code">
398
+ <tr>
399
+ <td>
400
+ <pre class="lines">
401
+
402
+
403
+ 41
404
+ 42
405
+ 43
406
+ 44
407
+ 45
408
+ 46
409
+ 47
410
+ 48
411
+ 49
412
+ 50
413
+ 51
414
+ 52
415
+ 53
416
+ 54
417
+ 55</pre>
418
+ </td>
419
+ <td>
420
+ <pre class="code"><span class="info file"># File 'lib/lazier/hash.rb', line 41</span>
421
+
422
+ <span class='kw'>def</span> <span class='id identifier rubyid_enable_dotted_access'>enable_dotted_access</span><span class='lparen'>(</span><span class='id identifier rubyid_readonly'>readonly</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
423
+ <span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='const'>Hashie</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>MethodReader</span><span class='rparen'>)</span>
424
+ <span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='const'>Hashie</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>MethodQuery</span><span class='rparen'>)</span>
425
+ <span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='const'>Hashie</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>MethodWriter</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_readonly'>readonly</span>
426
+
427
+ <span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
428
+ <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
429
+ <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_enable_dotted_access'>enable_dotted_access</span><span class='lparen'>(</span><span class='id identifier rubyid_readonly'>readonly</span><span class='rparen'>)</span>
430
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:each</span><span class='rparen'>)</span> <span class='kw'>then</span>
431
+ <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_element'>element</span><span class='op'>|</span>
432
+ <span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_enable_dotted_access'>enable_dotted_access</span><span class='lparen'>(</span><span class='id identifier rubyid_readonly'>readonly</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
433
+ <span class='kw'>end</span>
434
+ <span class='kw'>end</span>
435
+ <span class='kw'>end</span>
436
+ <span class='kw'>end</span></pre>
437
+ </td>
438
+ </tr>
439
+ </table>
440
+ </div>
441
+
442
+ <div class="method_details ">
443
+ <h3 class="signature " id="ensure_access-instance_method">
151
444
 
152
445
  - (<tt><span class='object_link'><a href="Object.html" title="Lazier::Object (module)">Object</a></span></tt>) <strong>ensure_access</strong>(access)
153
446
 
@@ -190,16 +483,16 @@
190
483
  <pre class="lines">
191
484
 
192
485
 
193
- 15
194
- 16
195
- 17
196
- 18</pre>
486
+ 32
487
+ 33
488
+ 34
489
+ 35</pre>
197
490
  </td>
198
491
  <td>
199
- <pre class="code"><span class="info file"># File 'lib/lazier/hash.rb', line 15</span>
492
+ <pre class="code"><span class="info file"># File 'lib/lazier/hash.rb', line 32</span>
200
493
 
201
494
  <span class='kw'>def</span> <span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='id identifier rubyid_access'>access</span><span class='rparen'>)</span>
202
- <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>strings:</span> <span class='symbol'>:stringify_keys</span><span class='comma'>,</span> <span class='label'>symbols:</span> <span class='symbol'>:symbolize_keys</span><span class='comma'>,</span> <span class='label'>indifferent:</span> <span class='symbol'>:with_indifferent_access</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_access'>access</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
495
+ <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>strings:</span> <span class='symbol'>:stringify_keys</span><span class='comma'>,</span> <span class='label'>symbols:</span> <span class='symbol'>:symbolize_keys</span><span class='comma'>,</span> <span class='label'>indifferent:</span> <span class='symbol'>:with_indifferent_access</span><span class='comma'>,</span> <span class='label'>dotted:</span> <span class='symbol'>:enable_dotted_access</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_access'>access</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
203
496
  <span class='id identifier rubyid_method'>method</span> <span class='op'>?</span> <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>self</span>
204
497
  <span class='kw'>end</span></pre>
205
498
  </td>
@@ -212,9 +505,9 @@
212
505
  </div>
213
506
 
214
507
  <div id="footer">
215
- Generated on Mon Dec 2 15:35:20 2013 by
508
+ Generated on Sat Jan 25 11:01:53 2014 by
216
509
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
217
- 0.8.7.3 (ruby-2.0.0).
510
+ 0.8.7.3 (ruby-2.1.0).
218
511
  </div>
219
512
 
220
513
  </body>