lazier 3.5.1 → 3.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/.rubocop.yml +29 -0
  4. data/.travis-gemfile +1 -1
  5. data/.travis.yml +2 -2
  6. data/CHANGELOG.md +5 -0
  7. data/Gemfile +3 -3
  8. data/README.md +1 -1
  9. data/doc/Lazier.html +56 -68
  10. data/doc/Lazier/Boolean.html +4 -4
  11. data/doc/Lazier/Configuration.html +5 -5
  12. data/doc/Lazier/DateTime.html +29 -29
  13. data/doc/Lazier/DateTime/ClassMethods.html +136 -124
  14. data/doc/Lazier/Exceptions.html +4 -4
  15. data/doc/Lazier/Exceptions/Debug.html +4 -4
  16. data/doc/Lazier/Exceptions/MissingTranslation.html +4 -4
  17. data/doc/Lazier/Hash.html +144 -32
  18. data/doc/Lazier/I18n.html +109 -103
  19. data/doc/Lazier/Localizer.html +4 -4
  20. data/doc/Lazier/Math.html +4 -4
  21. data/doc/Lazier/Math/ClassMethods.html +4 -4
  22. data/doc/Lazier/Object.html +357 -243
  23. data/doc/Lazier/Pathname.html +4 -4
  24. data/doc/Lazier/Settings.html +58 -34
  25. data/doc/Lazier/String.html +6 -6
  26. data/doc/Lazier/TimeZone.html +86 -86
  27. data/doc/Lazier/TimeZone/ClassMethods.html +66 -68
  28. data/doc/Lazier/Version.html +5 -5
  29. data/doc/_index.html +5 -5
  30. data/doc/css/style.css +1 -0
  31. data/doc/file.README.html +4 -4
  32. data/doc/frames.html +1 -1
  33. data/doc/index.html +4 -4
  34. data/doc/method_list.html +103 -91
  35. data/doc/top-level-namespace.html +4 -4
  36. data/lazier.gemspec +2 -2
  37. data/lib/lazier.rb +59 -22
  38. data/lib/lazier/boolean.rb +1 -1
  39. data/lib/lazier/configuration.rb +21 -20
  40. data/lib/lazier/datetime.rb +127 -101
  41. data/lib/lazier/hash.rb +20 -12
  42. data/lib/lazier/i18n.rb +33 -32
  43. data/lib/lazier/math.rb +1 -1
  44. data/lib/lazier/object.rb +102 -56
  45. data/lib/lazier/pathname.rb +1 -1
  46. data/lib/lazier/settings.rb +4 -2
  47. data/lib/lazier/string.rb +3 -3
  48. data/lib/lazier/version.rb +1 -1
  49. data/spec/lazier/datetime_spec.rb +1 -1
  50. data/spec/lazier/hash_spec.rb +2 -2
  51. data/spec/lazier/object_spec.rb +16 -0
  52. data/spec/lazier/string_spec.rb +4 -10
  53. data/spec/lazier_spec.rb +9 -9
  54. data/spec/spec_helper.rb +1 -1
  55. metadata +7 -6
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Lazier::Exceptions
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.3
9
+ &mdash; Documentation by YARD 0.8.7.4
10
10
 
11
11
  </title>
12
12
 
@@ -17,7 +17,7 @@
17
17
  <script type="text/javascript" charset="utf-8">
18
18
  hasFrames = window.top.frames.main ? true : false;
19
19
  relpath = '../';
20
- framesUrl = "../frames.html#!" + escape(window.location.href);
20
+ framesUrl = "../frames.html#!Lazier/Exceptions.html";
21
21
  </script>
22
22
 
23
23
 
@@ -116,9 +116,9 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Sun Feb 23 15:47:03 2014 by
119
+ Generated on Sun Apr 27 17:16:42 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.1.0).
121
+ 0.8.7.4 (ruby-2.1.0).
122
122
  </div>
123
123
 
124
124
  </body>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Exception: Lazier::Exceptions::Debug
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.3
9
+ &mdash; Documentation by YARD 0.8.7.4
10
10
 
11
11
  </title>
12
12
 
@@ -17,7 +17,7 @@
17
17
  <script type="text/javascript" charset="utf-8">
18
18
  hasFrames = window.top.frames.main ? true : false;
19
19
  relpath = '../../';
20
- framesUrl = "../../frames.html#!" + escape(window.location.href);
20
+ framesUrl = "../../frames.html#!Lazier/Exceptions/Debug.html";
21
21
  </script>
22
22
 
23
23
 
@@ -124,9 +124,9 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Sun Feb 23 15:47:03 2014 by
127
+ Generated on Sun Apr 27 17:16:42 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.1.0).
129
+ 0.8.7.4 (ruby-2.1.0).
130
130
  </div>
131
131
 
132
132
  </body>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Exception: Lazier::Exceptions::MissingTranslation
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.3
9
+ &mdash; Documentation by YARD 0.8.7.4
10
10
 
11
11
  </title>
12
12
 
@@ -17,7 +17,7 @@
17
17
  <script type="text/javascript" charset="utf-8">
18
18
  hasFrames = window.top.frames.main ? true : false;
19
19
  relpath = '../../';
20
- framesUrl = "../../frames.html#!" + escape(window.location.href);
20
+ framesUrl = "../../frames.html#!Lazier/Exceptions/MissingTranslation.html";
21
21
  </script>
22
22
 
23
23
 
@@ -238,9 +238,9 @@
238
238
  </div>
239
239
 
240
240
  <div id="footer">
241
- Generated on Sun Feb 23 15:47:03 2014 by
241
+ Generated on Sun Apr 27 17:16:43 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.1.0).
243
+ 0.8.7.4 (ruby-2.1.0).
244
244
  </div>
245
245
 
246
246
  </body>
data/doc/Lazier/Hash.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Lazier::Hash
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.3
9
+ &mdash; Documentation by YARD 0.8.7.4
10
10
 
11
11
  </title>
12
12
 
@@ -17,7 +17,7 @@
17
17
  <script type="text/javascript" charset="utf-8">
18
18
  hasFrames = window.top.frames.main ? true : false;
19
19
  relpath = '../';
20
- framesUrl = "../frames.html#!" + escape(window.location.href);
20
+ framesUrl = "../frames.html#!Lazier/Hash.html";
21
21
  </script>
22
22
 
23
23
 
@@ -206,6 +206,29 @@
206
206
  <span class="summary_desc"><div class='inline'><p>Makes sure that the hash is accessible using dotted notation.</p>
207
207
  </div></span>
208
208
 
209
+ </li>
210
+
211
+
212
+ <li class="public ">
213
+ <span class="summary_signature">
214
+
215
+ <a href="#enable_dotted_access_for_value-instance_method" title="#enable_dotted_access_for_value (instance method)">- (Hash) <strong>enable_dotted_access_for_value</strong>(value, readonly) </a>
216
+
217
+
218
+
219
+ </span>
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+ <span class="summary_desc"><div class='inline'><p>Makes sure that the value is accessible using dotted notation.</p>
230
+ </div></span>
231
+
209
232
  </li>
210
233
 
211
234
 
@@ -305,15 +328,13 @@
305
328
 
306
329
  24
307
330
  25
308
- 26
309
- 27</pre>
331
+ 26</pre>
310
332
  </td>
311
333
  <td>
312
334
  <pre class="code"><span class="info file"># File 'lib/lazier/hash.rb', line 24</span>
313
335
 
314
336
  <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>
315
- <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>
316
- <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>
337
+ <span class='id identifier rubyid_dup'>dup</span><span class='period'>.</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>
317
338
  <span class='kw'>end</span></pre>
318
339
  </td>
319
340
  </tr>
@@ -364,13 +385,13 @@
364
385
  <pre class="lines">
365
386
 
366
387
 
388
+ 31
367
389
  32
368
390
  33
369
- 34
370
- 35</pre>
391
+ 34</pre>
371
392
  </td>
372
393
  <td>
373
- <pre class="code"><span class="info file"># File 'lib/lazier/hash.rb', line 32</span>
394
+ <pre class="code"><span class="info file"># File 'lib/lazier/hash.rb', line 31</span>
374
395
 
375
396
  <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>
376
397
  <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>
@@ -444,6 +465,7 @@
444
465
  <pre class="lines">
445
466
 
446
467
 
468
+ 52
447
469
  53
448
470
  54
449
471
  55
@@ -453,31 +475,18 @@
453
475
  59
454
476
  60
455
477
  61
456
- 62
457
- 63
458
- 64
459
- 65
460
- 66
461
- 67
462
- 68
463
- 69</pre>
478
+ 62</pre>
464
479
  </td>
465
480
  <td>
466
- <pre class="code"><span class="info file"># File 'lib/lazier/hash.rb', line 53</span>
481
+ <pre class="code"><span class="info file"># File 'lib/lazier/hash.rb', line 52</span>
467
482
 
468
483
  <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>
469
484
  <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>
470
485
  <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>
471
- <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>
486
+ <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'>unless</span> <span class='id identifier rubyid_readonly'>readonly</span>
472
487
 
473
488
  <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>
474
- <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>
475
- <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>
476
- <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>
477
- <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>
478
- <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>
479
- <span class='kw'>end</span>
480
- <span class='kw'>end</span>
489
+ <span class='id identifier rubyid_enable_dotted_access_for_value'>enable_dotted_access_for_value</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_readonly'>readonly</span><span class='rparen'>)</span>
481
490
  <span class='kw'>end</span>
482
491
 
483
492
  <span class='kw'>self</span>
@@ -485,6 +494,109 @@
485
494
  </td>
486
495
  </tr>
487
496
  </table>
497
+ </div>
498
+
499
+ <div class="method_details ">
500
+ <h3 class="signature " id="enable_dotted_access_for_value-instance_method">
501
+
502
+ - (<tt><span class='object_link'><a href="" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>enable_dotted_access_for_value</strong>(value, readonly)
503
+
504
+
505
+
506
+
507
+
508
+ </h3><div class="docstring">
509
+ <div class="discussion">
510
+ <p>Makes sure that the value is accessible using dotted notation. This is also applied to every embedded hash.</p>
511
+
512
+
513
+ </div>
514
+ </div>
515
+ <div class="tags">
516
+ <p class="tag_title">Parameters:</p>
517
+ <ul class="param">
518
+
519
+ <li>
520
+
521
+ <span class='name'>value</span>
522
+
523
+
524
+ <span class='type'>(<tt><span class='object_link'><a href="Object.html" title="Lazier::Object (module)">Object</a></span></tt>)</span>
525
+
526
+
527
+
528
+ &mdash;
529
+ <div class='inline'><p>The value to manipulate.</p>
530
+ </div>
531
+
532
+ </li>
533
+
534
+ <li>
535
+
536
+ <span class='name'>readonly</span>
537
+
538
+
539
+ <span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
540
+
541
+
542
+
543
+ &mdash;
544
+ <div class='inline'><p>If the dotted notation is only enable for reading. <code>true</code> by default.</p>
545
+ </div>
546
+
547
+ </li>
548
+
549
+ </ul>
550
+
551
+ <p class="tag_title">Returns:</p>
552
+ <ul class="return">
553
+
554
+ <li>
555
+
556
+
557
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Lazier::Hash (module)">Hash</a></span></tt>)</span>
558
+
559
+
560
+
561
+ &mdash;
562
+ <div class='inline'><p>The current value enabled for dotted access.</p>
563
+ </div>
564
+
565
+ </li>
566
+
567
+ </ul>
568
+
569
+ </div><table class="source_code">
570
+ <tr>
571
+ <td>
572
+ <pre class="lines">
573
+
574
+
575
+ 69
576
+ 70
577
+ 71
578
+ 72
579
+ 73
580
+ 74
581
+ 75
582
+ 76
583
+ 77</pre>
584
+ </td>
585
+ <td>
586
+ <pre class="code"><span class="info file"># File 'lib/lazier/hash.rb', line 69</span>
587
+
588
+ <span class='kw'>def</span> <span class='id identifier rubyid_enable_dotted_access_for_value'>enable_dotted_access_for_value</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_readonly'>readonly</span><span class='rparen'>)</span>
589
+ <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>
590
+ <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>
591
+ <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>
592
+ <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>
593
+ <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>
594
+ <span class='kw'>end</span>
595
+ <span class='kw'>end</span>
596
+ <span class='kw'>end</span></pre>
597
+ </td>
598
+ </tr>
599
+ </table>
488
600
  </div>
489
601
 
490
602
  <div class="method_details ">
@@ -548,19 +660,19 @@
548
660
  <pre class="lines">
549
661
 
550
662
 
663
+ 40
551
664
  41
552
665
  42
553
666
  43
554
667
  44
555
668
  45
556
- 46
557
- 47</pre>
669
+ 46</pre>
558
670
  </td>
559
671
  <td>
560
- <pre class="code"><span class="info file"># File 'lib/lazier/hash.rb', line 41</span>
672
+ <pre class="code"><span class="info file"># File 'lib/lazier/hash.rb', line 40</span>
561
673
 
562
674
  <span class='kw'>def</span> <span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_accesses'>accesses</span><span class='rparen'>)</span>
563
- <span class='id identifier rubyid_accesses'>accesses</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_rv'>rv</span><span class='comma'>,</span> <span class='id identifier rubyid_access'>access</span><span class='op'>|</span>
675
+ <span class='id identifier rubyid_accesses'>accesses</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_rv'>rv</span><span class='comma'>,</span> <span class='id identifier rubyid_access'>access</span><span class='op'>|</span>
564
676
  <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='const'>VALID_ACCESSES</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='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
565
677
  <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</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='kw'>if</span> <span class='id identifier rubyid_method'>method</span>
566
678
  <span class='id identifier rubyid_rv'>rv</span>
@@ -576,9 +688,9 @@
576
688
  </div>
577
689
 
578
690
  <div id="footer">
579
- Generated on Sun Feb 23 15:47:03 2014 by
691
+ Generated on Sun Apr 27 17:16:42 2014 by
580
692
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
581
- 0.8.7.3 (ruby-2.1.0).
693
+ 0.8.7.4 (ruby-2.1.0).
582
694
  </div>
583
695
 
584
696
  </body>
data/doc/Lazier/I18n.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Lazier::I18n
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.3
9
+ &mdash; Documentation by YARD 0.8.7.4
10
10
 
11
11
  </title>
12
12
 
@@ -17,7 +17,7 @@
17
17
  <script type="text/javascript" charset="utf-8">
18
18
  hasFrames = window.top.frames.main ? true : false;
19
19
  relpath = '../';
20
- framesUrl = "../frames.html#!" + escape(window.location.href);
20
+ framesUrl = "../frames.html#!Lazier/I18n.html";
21
21
  </script>
22
22
 
23
23
 
@@ -389,7 +389,8 @@
389
389
  80
390
390
  81
391
391
  82
392
- 83</pre>
392
+ 83
393
+ 84</pre>
393
394
  </td>
394
395
  <td>
395
396
  <pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 16</span>
@@ -426,41 +427,42 @@
426
427
  <span class='kw'>end</span>
427
428
 
428
429
  <span class='id identifier rubyid_private'>private</span>
429
- <span class='comment'># Loads a locale for messages.
430
- </span> <span class='comment'>#
431
- </span> <span class='comment'># @param locale [Symbol] The new locale. Default is the current system locale.
432
- </span> <span class='comment'># @return [R18n::Translation] The new translation object.
433
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
434
- <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='ivar'>@i18n_locales_path</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
435
- <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='id identifier rubyid_validate_locales'>validate_locales</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
436
-
437
- <span class='kw'>begin</span>
438
- <span class='id identifier rubyid_tokens'>tokens</span> <span class='op'>=</span> <span class='ivar'>@i18n_root</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[:.]</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
439
- <span class='id identifier rubyid_translation'>translation</span> <span class='op'>=</span> <span class='id identifier rubyid_tokens'>tokens</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_accu'>accu</span><span class='comma'>,</span> <span class='id identifier rubyid_token'>token</span><span class='op'>|</span> <span class='id identifier rubyid_accu'>accu</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_token'>token</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
440
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span> <span class='kw'>if</span> <span class='id identifier rubyid_translation'>translation</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>R18n</span><span class='op'>::</span><span class='const'>Untranslated</span><span class='rparen'>)</span>
441
- <span class='id identifier rubyid_translation'>translation</span>
442
- <span class='kw'>rescue</span>
443
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>MissingTranslation</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
444
- <span class='kw'>end</span>
445
- <span class='kw'>end</span>
446
430
 
447
- <span class='comment'># Validates locales for messages.
448
- </span> <span class='comment'>#
449
- </span> <span class='comment'># @param locales [Array] The list of locales to validate. English is added as fallback.
450
- </span> <span class='comment'># @param path [String] The path where look into.
451
- </span> <span class='comment'># @return [Array] The list of valid locales.
452
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_validate_locales'>validate_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
453
- <span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>LANG</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_system_locale'>system_locale</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>en</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_l'>l</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:to_s</span><span class='rparen'>)</span>
431
+ <span class='comment'># Loads a locale for messages.
432
+ </span> <span class='comment'>#
433
+ </span> <span class='comment'># @param locale [Symbol] The new locale. Default is the current system locale.
434
+ </span> <span class='comment'># @return [R18n::Translation] The new translation object.
435
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
436
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='ivar'>@i18n_locales_path</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
437
+ <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='id identifier rubyid_validate_locales'>validate_locales</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
438
+
439
+ <span class='kw'>begin</span>
440
+ <span class='id identifier rubyid_tokens'>tokens</span> <span class='op'>=</span> <span class='ivar'>@i18n_root</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[:.]</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
441
+ <span class='id identifier rubyid_translation'>translation</span> <span class='op'>=</span> <span class='id identifier rubyid_tokens'>tokens</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='op'>|</span> <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_e'>e</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
442
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span> <span class='kw'>if</span> <span class='id identifier rubyid_translation'>translation</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>R18n</span><span class='op'>::</span><span class='const'>Untranslated</span><span class='rparen'>)</span>
443
+ <span class='id identifier rubyid_translation'>translation</span>
444
+ <span class='kw'>rescue</span>
445
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>MissingTranslation</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
454
446
  <span class='kw'>end</span>
447
+ <span class='kw'>end</span>
455
448
 
456
- <span class='comment'># Find a locale file in a path.
457
- </span> <span class='comment'>#
458
- </span> <span class='comment'># @param locale [String] The locale to find.
459
- </span> <span class='comment'># @param path [String] The path where look into.
460
- </span> <span class='comment'># @return [String|nil] The version of the locale found or `nil`, if nothing was found.
461
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
462
- <span class='id identifier rubyid_locale'>locale</span> <span class='op'>?</span> <span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>5</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>2</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_l'>l</span><span class='embexpr_end'>}</span><span class='tstring_content'>.yml</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='op'>:</span> <span class='kw'>nil</span>
463
- <span class='kw'>end</span>
449
+ <span class='comment'># Validates locales for messages.
450
+ </span> <span class='comment'>#
451
+ </span> <span class='comment'># @param locales [Array] The list of locales to validate. English is added as fallback.
452
+ </span> <span class='comment'># @param path [String] The path where look into.
453
+ </span> <span class='comment'># @return [Array] The list of valid locales.
454
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_validate_locales'>validate_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
455
+ <span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>LANG</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_system_locale'>system_locale</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>en</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_l'>l</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:to_s</span><span class='rparen'>)</span>
456
+ <span class='kw'>end</span>
457
+
458
+ <span class='comment'># Find a locale file in a path.
459
+ </span> <span class='comment'>#
460
+ </span> <span class='comment'># @param locale [String] The locale to find.
461
+ </span> <span class='comment'># @param path [String] The path where look into.
462
+ </span> <span class='comment'># @return [String|nil] The version of the locale found or `nil`, if nothing was found.
463
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
464
+ <span class='id identifier rubyid_locale'>locale</span> <span class='op'>?</span> <span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>5</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>2</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_l'>l</span><span class='embexpr_end'>}</span><span class='tstring_content'>.yml</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='op'>:</span> <span class='kw'>nil</span>
465
+ <span class='kw'>end</span>
464
466
  <span class='kw'>end</span></pre>
465
467
  </td>
466
468
  </tr>
@@ -578,7 +580,8 @@
578
580
  80
579
581
  81
580
582
  82
581
- 83</pre>
583
+ 83
584
+ 84</pre>
582
585
  </td>
583
586
  <td>
584
587
  <pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 16</span>
@@ -615,41 +618,42 @@
615
618
  <span class='kw'>end</span>
616
619
 
617
620
  <span class='id identifier rubyid_private'>private</span>
618
- <span class='comment'># Loads a locale for messages.
619
- </span> <span class='comment'>#
620
- </span> <span class='comment'># @param locale [Symbol] The new locale. Default is the current system locale.
621
- </span> <span class='comment'># @return [R18n::Translation] The new translation object.
622
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
623
- <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='ivar'>@i18n_locales_path</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
624
- <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='id identifier rubyid_validate_locales'>validate_locales</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
625
-
626
- <span class='kw'>begin</span>
627
- <span class='id identifier rubyid_tokens'>tokens</span> <span class='op'>=</span> <span class='ivar'>@i18n_root</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[:.]</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
628
- <span class='id identifier rubyid_translation'>translation</span> <span class='op'>=</span> <span class='id identifier rubyid_tokens'>tokens</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_accu'>accu</span><span class='comma'>,</span> <span class='id identifier rubyid_token'>token</span><span class='op'>|</span> <span class='id identifier rubyid_accu'>accu</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_token'>token</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
629
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span> <span class='kw'>if</span> <span class='id identifier rubyid_translation'>translation</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>R18n</span><span class='op'>::</span><span class='const'>Untranslated</span><span class='rparen'>)</span>
630
- <span class='id identifier rubyid_translation'>translation</span>
631
- <span class='kw'>rescue</span>
632
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>MissingTranslation</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
633
- <span class='kw'>end</span>
634
- <span class='kw'>end</span>
635
621
 
636
- <span class='comment'># Validates locales for messages.
637
- </span> <span class='comment'>#
638
- </span> <span class='comment'># @param locales [Array] The list of locales to validate. English is added as fallback.
639
- </span> <span class='comment'># @param path [String] The path where look into.
640
- </span> <span class='comment'># @return [Array] The list of valid locales.
641
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_validate_locales'>validate_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
642
- <span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>LANG</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_system_locale'>system_locale</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>en</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_l'>l</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:to_s</span><span class='rparen'>)</span>
622
+ <span class='comment'># Loads a locale for messages.
623
+ </span> <span class='comment'>#
624
+ </span> <span class='comment'># @param locale [Symbol] The new locale. Default is the current system locale.
625
+ </span> <span class='comment'># @return [R18n::Translation] The new translation object.
626
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
627
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='ivar'>@i18n_locales_path</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
628
+ <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='id identifier rubyid_validate_locales'>validate_locales</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
629
+
630
+ <span class='kw'>begin</span>
631
+ <span class='id identifier rubyid_tokens'>tokens</span> <span class='op'>=</span> <span class='ivar'>@i18n_root</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[:.]</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
632
+ <span class='id identifier rubyid_translation'>translation</span> <span class='op'>=</span> <span class='id identifier rubyid_tokens'>tokens</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='op'>|</span> <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_e'>e</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
633
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span> <span class='kw'>if</span> <span class='id identifier rubyid_translation'>translation</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>R18n</span><span class='op'>::</span><span class='const'>Untranslated</span><span class='rparen'>)</span>
634
+ <span class='id identifier rubyid_translation'>translation</span>
635
+ <span class='kw'>rescue</span>
636
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>MissingTranslation</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
643
637
  <span class='kw'>end</span>
638
+ <span class='kw'>end</span>
644
639
 
645
- <span class='comment'># Find a locale file in a path.
646
- </span> <span class='comment'>#
647
- </span> <span class='comment'># @param locale [String] The locale to find.
648
- </span> <span class='comment'># @param path [String] The path where look into.
649
- </span> <span class='comment'># @return [String|nil] The version of the locale found or `nil`, if nothing was found.
650
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
651
- <span class='id identifier rubyid_locale'>locale</span> <span class='op'>?</span> <span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>5</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>2</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_l'>l</span><span class='embexpr_end'>}</span><span class='tstring_content'>.yml</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='op'>:</span> <span class='kw'>nil</span>
652
- <span class='kw'>end</span>
640
+ <span class='comment'># Validates locales for messages.
641
+ </span> <span class='comment'>#
642
+ </span> <span class='comment'># @param locales [Array] The list of locales to validate. English is added as fallback.
643
+ </span> <span class='comment'># @param path [String] The path where look into.
644
+ </span> <span class='comment'># @return [Array] The list of valid locales.
645
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_validate_locales'>validate_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
646
+ <span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>LANG</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_system_locale'>system_locale</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>en</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_l'>l</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:to_s</span><span class='rparen'>)</span>
647
+ <span class='kw'>end</span>
648
+
649
+ <span class='comment'># Find a locale file in a path.
650
+ </span> <span class='comment'>#
651
+ </span> <span class='comment'># @param locale [String] The locale to find.
652
+ </span> <span class='comment'># @param path [String] The path where look into.
653
+ </span> <span class='comment'># @return [String|nil] The version of the locale found or `nil`, if nothing was found.
654
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
655
+ <span class='id identifier rubyid_locale'>locale</span> <span class='op'>?</span> <span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>5</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>2</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_l'>l</span><span class='embexpr_end'>}</span><span class='tstring_content'>.yml</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='op'>:</span> <span class='kw'>nil</span>
656
+ <span class='kw'>end</span>
653
657
  <span class='kw'>end</span></pre>
654
658
  </td>
655
659
  </tr>
@@ -767,7 +771,8 @@
767
771
  80
768
772
  81
769
773
  82
770
- 83</pre>
774
+ 83
775
+ 84</pre>
771
776
  </td>
772
777
  <td>
773
778
  <pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 16</span>
@@ -804,41 +809,42 @@
804
809
  <span class='kw'>end</span>
805
810
 
806
811
  <span class='id identifier rubyid_private'>private</span>
807
- <span class='comment'># Loads a locale for messages.
808
- </span> <span class='comment'>#
809
- </span> <span class='comment'># @param locale [Symbol] The new locale. Default is the current system locale.
810
- </span> <span class='comment'># @return [R18n::Translation] The new translation object.
811
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
812
- <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='ivar'>@i18n_locales_path</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
813
- <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='id identifier rubyid_validate_locales'>validate_locales</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
814
-
815
- <span class='kw'>begin</span>
816
- <span class='id identifier rubyid_tokens'>tokens</span> <span class='op'>=</span> <span class='ivar'>@i18n_root</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[:.]</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
817
- <span class='id identifier rubyid_translation'>translation</span> <span class='op'>=</span> <span class='id identifier rubyid_tokens'>tokens</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_accu'>accu</span><span class='comma'>,</span> <span class='id identifier rubyid_token'>token</span><span class='op'>|</span> <span class='id identifier rubyid_accu'>accu</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_token'>token</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
818
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span> <span class='kw'>if</span> <span class='id identifier rubyid_translation'>translation</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>R18n</span><span class='op'>::</span><span class='const'>Untranslated</span><span class='rparen'>)</span>
819
- <span class='id identifier rubyid_translation'>translation</span>
820
- <span class='kw'>rescue</span>
821
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>MissingTranslation</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
822
- <span class='kw'>end</span>
823
- <span class='kw'>end</span>
824
812
 
825
- <span class='comment'># Validates locales for messages.
826
- </span> <span class='comment'>#
827
- </span> <span class='comment'># @param locales [Array] The list of locales to validate. English is added as fallback.
828
- </span> <span class='comment'># @param path [String] The path where look into.
829
- </span> <span class='comment'># @return [Array] The list of valid locales.
830
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_validate_locales'>validate_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
831
- <span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>LANG</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_system_locale'>system_locale</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>en</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_l'>l</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:to_s</span><span class='rparen'>)</span>
813
+ <span class='comment'># Loads a locale for messages.
814
+ </span> <span class='comment'>#
815
+ </span> <span class='comment'># @param locale [Symbol] The new locale. Default is the current system locale.
816
+ </span> <span class='comment'># @return [R18n::Translation] The new translation object.
817
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
818
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='ivar'>@i18n_locales_path</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
819
+ <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='id identifier rubyid_validate_locales'>validate_locales</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
820
+
821
+ <span class='kw'>begin</span>
822
+ <span class='id identifier rubyid_tokens'>tokens</span> <span class='op'>=</span> <span class='ivar'>@i18n_root</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[:.]</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
823
+ <span class='id identifier rubyid_translation'>translation</span> <span class='op'>=</span> <span class='id identifier rubyid_tokens'>tokens</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='op'>|</span> <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_e'>e</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
824
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span> <span class='kw'>if</span> <span class='id identifier rubyid_translation'>translation</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>R18n</span><span class='op'>::</span><span class='const'>Untranslated</span><span class='rparen'>)</span>
825
+ <span class='id identifier rubyid_translation'>translation</span>
826
+ <span class='kw'>rescue</span>
827
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>MissingTranslation</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
832
828
  <span class='kw'>end</span>
829
+ <span class='kw'>end</span>
833
830
 
834
- <span class='comment'># Find a locale file in a path.
835
- </span> <span class='comment'>#
836
- </span> <span class='comment'># @param locale [String] The locale to find.
837
- </span> <span class='comment'># @param path [String] The path where look into.
838
- </span> <span class='comment'># @return [String|nil] The version of the locale found or `nil`, if nothing was found.
839
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
840
- <span class='id identifier rubyid_locale'>locale</span> <span class='op'>?</span> <span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>5</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>2</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_l'>l</span><span class='embexpr_end'>}</span><span class='tstring_content'>.yml</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='op'>:</span> <span class='kw'>nil</span>
841
- <span class='kw'>end</span>
831
+ <span class='comment'># Validates locales for messages.
832
+ </span> <span class='comment'>#
833
+ </span> <span class='comment'># @param locales [Array] The list of locales to validate. English is added as fallback.
834
+ </span> <span class='comment'># @param path [String] The path where look into.
835
+ </span> <span class='comment'># @return [Array] The list of valid locales.
836
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_validate_locales'>validate_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
837
+ <span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>LANG</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_system_locale'>system_locale</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>en</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_l'>l</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:to_s</span><span class='rparen'>)</span>
838
+ <span class='kw'>end</span>
839
+
840
+ <span class='comment'># Find a locale file in a path.
841
+ </span> <span class='comment'>#
842
+ </span> <span class='comment'># @param locale [String] The locale to find.
843
+ </span> <span class='comment'># @param path [String] The path where look into.
844
+ </span> <span class='comment'># @return [String|nil] The version of the locale found or `nil`, if nothing was found.
845
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
846
+ <span class='id identifier rubyid_locale'>locale</span> <span class='op'>?</span> <span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>5</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>2</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_l'>l</span><span class='embexpr_end'>}</span><span class='tstring_content'>.yml</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='op'>:</span> <span class='kw'>nil</span>
847
+ <span class='kw'>end</span>
842
848
  <span class='kw'>end</span></pre>
843
849
  </td>
844
850
  </tr>
@@ -1070,9 +1076,9 @@
1070
1076
  </div>
1071
1077
 
1072
1078
  <div id="footer">
1073
- Generated on Sun Feb 23 15:47:03 2014 by
1079
+ Generated on Sun Apr 27 17:16:42 2014 by
1074
1080
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1075
- 0.8.7.3 (ruby-2.1.0).
1081
+ 0.8.7.4 (ruby-2.1.0).
1076
1082
  </div>
1077
1083
 
1078
1084
  </body>