dh_easy-config 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1395 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: DhEasy::Config::Local
8
+
9
+ &mdash; Documentation by YARD 0.9.20
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "DhEasy::Config::Local";
19
+ relpath = '../../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../../_index.html">Index (L)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Config.html" title="DhEasy::Config (module)">Config</a></span></span>
41
+ &raquo;
42
+ <span class="title">Local</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: DhEasy::Config::Local
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">DhEasy::Config::Local</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/dh_easy/config/local.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>Manage configuration from a file.</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div>
114
+
115
+
116
+
117
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
118
+ <ul class="summary">
119
+
120
+ <li class="public ">
121
+ <span class="summary_signature">
122
+
123
+ <a href="#local-instance_method" title="#local (instance method)">#<strong>local</strong> &#x21d2; Hash<sup>?</sup> </a>
124
+
125
+
126
+
127
+ </span>
128
+
129
+
130
+
131
+
132
+ <span class="note title readonly">readonly</span>
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+ <span class="summary_desc"><div class='inline'>
143
+ <p>Configuration loaded from local configuarion file (see #load).</p>
144
+ </div></span>
145
+
146
+ </li>
147
+
148
+
149
+ </ul>
150
+
151
+
152
+
153
+
154
+
155
+ <h2>
156
+ Class Method Summary
157
+ <small><a href="#" class="summary_toggle">collapse</a></small>
158
+ </h2>
159
+
160
+ <ul class="summary">
161
+
162
+ <li class="public ">
163
+ <span class="summary_signature">
164
+
165
+ <a href="#clear_cache-class_method" title="clear_cache (class method)">.<strong>clear_cache</strong> &#x21d2; Object </a>
166
+
167
+
168
+
169
+ </span>
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+ <span class="summary_desc"><div class='inline'>
180
+ <p>Clear cache.</p>
181
+ </div></span>
182
+
183
+ </li>
184
+
185
+
186
+ <li class="public ">
187
+ <span class="summary_signature">
188
+
189
+ <a href="#default_file_path_list-class_method" title="default_file_path_list (class method)">.<strong>default_file_path_list</strong> &#x21d2; Array&lt;String&gt; </a>
190
+
191
+
192
+
193
+ </span>
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+ <span class="summary_desc"><div class='inline'>
204
+ <p>Default configuration file path list to be prioritized from first to last.</p>
205
+ </div></span>
206
+
207
+ </li>
208
+
209
+
210
+ <li class="public ">
211
+ <span class="summary_signature">
212
+
213
+ <a href="#load_file-class_method" title="load_file (class method)">.<strong>load_file</strong>(file_path, opts = {}) &#x21d2; Hash </a>
214
+
215
+
216
+
217
+ </span>
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+ <span class="summary_desc"><div class='inline'>
228
+ <p>Load into or from cache a configuration file contents.</p>
229
+ </div></span>
230
+
231
+ </li>
232
+
233
+
234
+ </ul>
235
+
236
+ <h2>
237
+ Instance Method Summary
238
+ <small><a href="#" class="summary_toggle">collapse</a></small>
239
+ </h2>
240
+
241
+ <ul class="summary">
242
+
243
+ <li class="public ">
244
+ <span class="summary_signature">
245
+
246
+ <a href="#[]-instance_method" title="#[] (instance method)">#<strong>[]</strong>(key) &#x21d2; Object<sup>?</sup> </a>
247
+
248
+
249
+
250
+ </span>
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+ <span class="summary_desc"><div class='inline'>
261
+ <p>Get configuration key contents.</p>
262
+ </div></span>
263
+
264
+ </li>
265
+
266
+
267
+ <li class="public ">
268
+ <span class="summary_signature">
269
+
270
+ <a href="#file_path-instance_method" title="#file_path (instance method)">#<strong>file_path</strong> &#x21d2; String </a>
271
+
272
+
273
+
274
+ </span>
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+ <span class="summary_desc"><div class='inline'>
285
+ <p>Local configuration file path.</p>
286
+ </div></span>
287
+
288
+ </li>
289
+
290
+
291
+ <li class="public ">
292
+ <span class="summary_signature">
293
+
294
+ <a href="#file_path_list-instance_method" title="#file_path_list (instance method)">#<strong>file_path_list</strong> &#x21d2; Array&lt;String&gt; </a>
295
+
296
+
297
+
298
+ </span>
299
+
300
+
301
+
302
+
303
+
304
+
305
+
306
+
307
+
308
+ <span class="summary_desc"><div class='inline'>
309
+ <p>Local configuration file path list.</p>
310
+ </div></span>
311
+
312
+ </li>
313
+
314
+
315
+ <li class="public ">
316
+ <span class="summary_signature">
317
+
318
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(opts = {}) &#x21d2; Local </a>
319
+
320
+
321
+
322
+ </span>
323
+
324
+
325
+ <span class="note title constructor">constructor</span>
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+ <span class="summary_desc"><div class='inline'>
335
+ <p>Initialize.</p>
336
+ </div></span>
337
+
338
+ </li>
339
+
340
+
341
+ <li class="public ">
342
+ <span class="summary_signature">
343
+
344
+ <a href="#load-instance_method" title="#load (instance method)">#<strong>load</strong>(opts = {}) &#x21d2; Object </a>
345
+
346
+
347
+
348
+ </span>
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+ <span class="summary_desc"><div class='inline'>
359
+ <p>Loads a local configuration file.</p>
360
+ </div></span>
361
+
362
+ </li>
363
+
364
+
365
+ <li class="public ">
366
+ <span class="summary_signature">
367
+
368
+ <a href="#lookup_file_path-instance_method" title="#lookup_file_path (instance method)">#<strong>lookup_file_path</strong> &#x21d2; String<sup>?</sup> </a>
369
+
370
+
371
+
372
+ </span>
373
+
374
+
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+ <span class="summary_desc"><div class='inline'>
383
+ <p>Lookup #file_path_list for the first valid file.</p>
384
+ </div></span>
385
+
386
+ </li>
387
+
388
+
389
+ <li class="public ">
390
+ <span class="summary_signature">
391
+
392
+ <a href="#reload!-instance_method" title="#reload! (instance method)">#<strong>reload!</strong> &#x21d2; Object </a>
393
+
394
+
395
+
396
+ </span>
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+ <span class="summary_desc"><div class='inline'>
407
+ <p>Reloads local configuration file.</p>
408
+ </div></span>
409
+
410
+ </li>
411
+
412
+
413
+ <li class="public ">
414
+ <span class="summary_signature">
415
+
416
+ <a href="#reset!-instance_method" title="#reset! (instance method)">#<strong>reset!</strong> &#x21d2; Object </a>
417
+
418
+
419
+
420
+ </span>
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+
429
+
430
+ <span class="summary_desc"><div class='inline'>
431
+ <p>Reset instance to lookup for valid files from #file_path_list and load
432
+ the first valid configuration file found.</p>
433
+ </div></span>
434
+
435
+ </li>
436
+
437
+
438
+ <li class="public ">
439
+ <span class="summary_signature">
440
+
441
+ <a href="#to_h-instance_method" title="#to_h (instance method)">#<strong>to_h</strong> &#x21d2; Hash </a>
442
+
443
+
444
+
445
+ </span>
446
+
447
+
448
+
449
+
450
+
451
+
452
+
453
+
454
+
455
+ <span class="summary_desc"><div class='inline'>
456
+ <p>Convert to hash.</p>
457
+ </div></span>
458
+
459
+ </li>
460
+
461
+
462
+ </ul>
463
+
464
+
465
+ <div id="constructor_details" class="method_details_list">
466
+ <h2>Constructor Details</h2>
467
+
468
+ <div class="method_details first">
469
+ <h3 class="signature first" id="initialize-instance_method">
470
+
471
+ #<strong>initialize</strong>(opts = {}) &#x21d2; <tt><span class='object_link'><a href="" title="DhEasy::Config::Local (class)">Local</a></span></tt>
472
+
473
+
474
+
475
+
476
+
477
+ </h3><div class="docstring">
478
+ <div class="discussion">
479
+
480
+ <p>Initialize.</p>
481
+
482
+
483
+ </div>
484
+ </div>
485
+ <div class="tags">
486
+ <p class="tag_title">Parameters:</p>
487
+ <ul class="param">
488
+
489
+ <li>
490
+
491
+ <span class='name'>opts</span>
492
+
493
+
494
+ <span class='type'>(<tt>Hash</tt>)</span>
495
+
496
+
497
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
498
+
499
+
500
+ &mdash;
501
+ <div class='inline'>
502
+ <p>({}) Configuration options (see #load).</p>
503
+ </div>
504
+
505
+ </li>
506
+
507
+ </ul>
508
+
509
+
510
+ </div><table class="source_code">
511
+ <tr>
512
+ <td>
513
+ <pre class="lines">
514
+
515
+
516
+ 122
517
+ 123
518
+ 124
519
+ 125</pre>
520
+ </td>
521
+ <td>
522
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/config/local.rb', line 122</span>
523
+
524
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
525
+ <span class='ivar'>@file_path_list</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:file_path_list</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:file_path_list</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
526
+ <span class='id identifier rubyid_load'>load</span> <span class='id identifier rubyid_opts'>opts</span>
527
+ <span class='kw'>end</span></pre>
528
+ </td>
529
+ </tr>
530
+ </table>
531
+ </div>
532
+
533
+ </div>
534
+
535
+ <div id="instance_attr_details" class="attr_details">
536
+ <h2>Instance Attribute Details</h2>
537
+
538
+
539
+ <span id=""></span>
540
+ <div class="method_details first">
541
+ <h3 class="signature first" id="local-instance_method">
542
+
543
+ #<strong>local</strong> &#x21d2; <tt>Hash</tt><sup>?</sup> <span class="extras">(readonly)</span>
544
+
545
+
546
+
547
+
548
+
549
+ </h3><div class="docstring">
550
+ <div class="discussion">
551
+
552
+ <p>Configuration loaded from local configuarion file (see #load).</p>
553
+
554
+
555
+ </div>
556
+ </div>
557
+ <div class="tags">
558
+
559
+ <p class="tag_title">Returns:</p>
560
+ <ul class="return">
561
+
562
+ <li>
563
+
564
+
565
+ <span class='type'>(<tt>Hash</tt>, <tt>nil</tt>)</span>
566
+
567
+
568
+
569
+ &mdash;
570
+ <div class='inline'>
571
+ <p>`nil` when nothing has been loaded.</p>
572
+ </div>
573
+
574
+ </li>
575
+
576
+ </ul>
577
+
578
+ </div><table class="source_code">
579
+ <tr>
580
+ <td>
581
+ <pre class="lines">
582
+
583
+
584
+ 8
585
+ 9
586
+ 10</pre>
587
+ </td>
588
+ <td>
589
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/config/local.rb', line 8</span>
590
+
591
+ <span class='kw'>def</span> <span class='id identifier rubyid_local'>local</span>
592
+ <span class='ivar'>@local</span>
593
+ <span class='kw'>end</span></pre>
594
+ </td>
595
+ </tr>
596
+ </table>
597
+ </div>
598
+
599
+ </div>
600
+
601
+
602
+ <div id="class_method_details" class="method_details_list">
603
+ <h2>Class Method Details</h2>
604
+
605
+
606
+ <div class="method_details first">
607
+ <h3 class="signature first" id="clear_cache-class_method">
608
+
609
+ .<strong>clear_cache</strong> &#x21d2; <tt>Object</tt>
610
+
611
+
612
+
613
+
614
+
615
+ </h3><div class="docstring">
616
+ <div class="discussion">
617
+
618
+ <p>Clear cache.</p>
619
+
620
+
621
+ </div>
622
+ </div>
623
+ <div class="tags">
624
+
625
+
626
+ </div><table class="source_code">
627
+ <tr>
628
+ <td>
629
+ <pre class="lines">
630
+
631
+
632
+ 11
633
+ 12
634
+ 13</pre>
635
+ </td>
636
+ <td>
637
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/config/local.rb', line 11</span>
638
+
639
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_clear_cache'>clear_cache</span>
640
+ <span class='cvar'>@@local</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
641
+ <span class='kw'>end</span></pre>
642
+ </td>
643
+ </tr>
644
+ </table>
645
+ </div>
646
+
647
+ <div class="method_details ">
648
+ <h3 class="signature " id="default_file_path_list-class_method">
649
+
650
+ .<strong>default_file_path_list</strong> &#x21d2; <tt>Array&lt;String&gt;</tt>
651
+
652
+
653
+
654
+
655
+
656
+ </h3><div class="docstring">
657
+ <div class="discussion">
658
+
659
+ <p>Default configuration file path list to be prioritized from first to last.</p>
660
+
661
+
662
+ </div>
663
+ </div>
664
+ <div class="tags">
665
+
666
+ <p class="tag_title">Returns:</p>
667
+ <ul class="return">
668
+
669
+ <li>
670
+
671
+
672
+ <span class='type'>(<tt>Array&lt;String&gt;</tt>)</span>
673
+
674
+
675
+
676
+ &mdash;
677
+ <div class='inline'>
678
+ <p>Configuration file path list. Default is `[&#39;./dh_easy.yaml&#39;,
679
+ &#39;./dh_easy.yml&#39;]`</p>
680
+ </div>
681
+
682
+ </li>
683
+
684
+ </ul>
685
+
686
+ </div><table class="source_code">
687
+ <tr>
688
+ <td>
689
+ <pre class="lines">
690
+
691
+
692
+ 42
693
+ 43
694
+ 44
695
+ 45
696
+ 46
697
+ 47</pre>
698
+ </td>
699
+ <td>
700
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/config/local.rb', line 42</span>
701
+
702
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_default_file_path_list'>default_file_path_list</span>
703
+ <span class='cvar'>@@default_file_path_list</span> <span class='op'>||=</span> <span class='lbracket'>[</span>
704
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>./dh_easy.yaml</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
705
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>./dh_easy.yml</span><span class='tstring_end'>&#39;</span></span>
706
+ <span class='rbracket'>]</span>
707
+ <span class='kw'>end</span></pre>
708
+ </td>
709
+ </tr>
710
+ </table>
711
+ </div>
712
+
713
+ <div class="method_details ">
714
+ <h3 class="signature " id="load_file-class_method">
715
+
716
+ .<strong>load_file</strong>(file_path, opts = {}) &#x21d2; <tt>Hash</tt>
717
+
718
+
719
+
720
+
721
+
722
+ </h3><div class="docstring">
723
+ <div class="discussion">
724
+
725
+ <p>Load into or from cache a configuration file contents.</p>
726
+
727
+
728
+ </div>
729
+ </div>
730
+ <div class="tags">
731
+ <p class="tag_title">Parameters:</p>
732
+ <ul class="param">
733
+
734
+ <li>
735
+
736
+ <span class='name'>file_path</span>
737
+
738
+
739
+ <span class='type'>(<tt>String</tt>)</span>
740
+
741
+
742
+
743
+ &mdash;
744
+ <div class='inline'>
745
+ <p>Configuration file path.</p>
746
+ </div>
747
+
748
+ </li>
749
+
750
+ <li>
751
+
752
+ <span class='name'>opts</span>
753
+
754
+
755
+ <span class='type'>(<tt>Hash</tt>)</span>
756
+
757
+
758
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
759
+
760
+
761
+ &mdash;
762
+ <div class='inline'>
763
+ <p>({}) Configuration options.</p>
764
+ </div>
765
+
766
+ </li>
767
+
768
+ </ul>
769
+
770
+
771
+
772
+
773
+
774
+
775
+ <p class="tag_title">Options Hash (<tt>opts</tt>):</p>
776
+ <ul class="option">
777
+
778
+ <li>
779
+ <span class="name">:force</span>
780
+ <span class="type">(<tt>Boolean</tt>)</span>
781
+ <span class="default">
782
+
783
+ &mdash; default:
784
+ <tt>false</tt>
785
+
786
+ </span>
787
+
788
+ &mdash; <div class='inline'>
789
+ <p>Will reload configuration file when `true`.</p>
790
+ </div>
791
+
792
+ </li>
793
+
794
+ </ul>
795
+
796
+
797
+ <p class="tag_title">Returns:</p>
798
+ <ul class="return">
799
+
800
+ <li>
801
+
802
+
803
+ <span class='type'>(<tt>Hash</tt>)</span>
804
+
805
+
806
+
807
+ &mdash;
808
+ <div class='inline'>
809
+ <p>Configuration file contents.</p>
810
+ </div>
811
+
812
+ </li>
813
+
814
+ </ul>
815
+
816
+ </div><table class="source_code">
817
+ <tr>
818
+ <td>
819
+ <pre class="lines">
820
+
821
+
822
+ 23
823
+ 24
824
+ 25
825
+ 26
826
+ 27
827
+ 28
828
+ 29
829
+ 30
830
+ 31
831
+ 32
832
+ 33
833
+ 34
834
+ 35
835
+ 36</pre>
836
+ </td>
837
+ <td>
838
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/config/local.rb', line 23</span>
839
+
840
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_load_file'>load_file</span> <span class='id identifier rubyid_file_path'>file_path</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
841
+ <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span>
842
+ <span class='label'>force:</span> <span class='kw'>false</span>
843
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span> <span class='id identifier rubyid_opts'>opts</span>
844
+
845
+ <span class='kw'>return</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_file_path'>file_path</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
846
+
847
+ <span class='cvar'>@@local</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
848
+ <span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_file_path'>file_path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span> <span class='id identifier rubyid_file_path'>file_path</span>
849
+ <span class='kw'>return</span> <span class='cvar'>@@local</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:force</span><span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='cvar'>@@local</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
850
+
851
+ <span class='cvar'>@@local</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='const'>YAML</span><span class='period'>.</span><span class='id identifier rubyid_load_file'>load_file</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span> <span class='kw'>rescue</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
852
+ <span class='cvar'>@@local</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
853
+ <span class='kw'>end</span></pre>
854
+ </td>
855
+ </tr>
856
+ </table>
857
+ </div>
858
+
859
+ </div>
860
+
861
+ <div id="instance_method_details" class="method_details_list">
862
+ <h2>Instance Method Details</h2>
863
+
864
+
865
+ <div class="method_details first">
866
+ <h3 class="signature first" id="[]-instance_method">
867
+
868
+ #<strong>[]</strong>(key) &#x21d2; <tt>Object</tt><sup>?</sup>
869
+
870
+
871
+
872
+
873
+
874
+ </h3><div class="docstring">
875
+ <div class="discussion">
876
+
877
+ <p>Get configuration key contents.</p>
878
+
879
+
880
+ </div>
881
+ </div>
882
+ <div class="tags">
883
+ <p class="tag_title">Parameters:</p>
884
+ <ul class="param">
885
+
886
+ <li>
887
+
888
+ <span class='name'>key</span>
889
+
890
+
891
+ <span class='type'>(<tt>String</tt>)</span>
892
+
893
+
894
+
895
+ &mdash;
896
+ <div class='inline'>
897
+ <p>Configuration option key.</p>
898
+ </div>
899
+
900
+ </li>
901
+
902
+ </ul>
903
+
904
+ <p class="tag_title">Returns:</p>
905
+ <ul class="return">
906
+
907
+ <li>
908
+
909
+
910
+ <span class='type'>(<tt>Object</tt>, <tt>nil</tt>)</span>
911
+
912
+
913
+
914
+ </li>
915
+
916
+ </ul>
917
+
918
+ </div><table class="source_code">
919
+ <tr>
920
+ <td>
921
+ <pre class="lines">
922
+
923
+
924
+ 61
925
+ 62
926
+ 63</pre>
927
+ </td>
928
+ <td>
929
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/config/local.rb', line 61</span>
930
+
931
+ <span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
932
+ <span class='id identifier rubyid_local'>local</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span>
933
+ <span class='kw'>end</span></pre>
934
+ </td>
935
+ </tr>
936
+ </table>
937
+ </div>
938
+
939
+ <div class="method_details ">
940
+ <h3 class="signature " id="file_path-instance_method">
941
+
942
+ #<strong>file_path</strong> &#x21d2; <tt>String</tt>
943
+
944
+
945
+
946
+
947
+
948
+ </h3><div class="docstring">
949
+ <div class="discussion">
950
+
951
+ <p>Local configuration file path. It will lookup for the first valid file</p>
952
+
953
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_at'>at</span> <span class='comment'>#file_path_list as default value.
954
+ </span></code></pre>
955
+
956
+
957
+ </div>
958
+ </div>
959
+ <div class="tags">
960
+
961
+ <p class="tag_title">Returns:</p>
962
+ <ul class="return">
963
+
964
+ <li>
965
+
966
+
967
+ <span class='type'>(<tt>String</tt>)</span>
968
+
969
+
970
+
971
+ &mdash;
972
+ <div class='inline'>
973
+ <p>Configuration local file path.</p>
974
+ </div>
975
+
976
+ </li>
977
+
978
+ </ul>
979
+
980
+ </div><table class="source_code">
981
+ <tr>
982
+ <td>
983
+ <pre class="lines">
984
+
985
+
986
+ 80
987
+ 81
988
+ 82</pre>
989
+ </td>
990
+ <td>
991
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/config/local.rb', line 80</span>
992
+
993
+ <span class='kw'>def</span> <span class='id identifier rubyid_file_path'>file_path</span>
994
+ <span class='ivar'>@file_path</span> <span class='op'>||=</span> <span class='id identifier rubyid_lookup_file_path'>lookup_file_path</span>
995
+ <span class='kw'>end</span></pre>
996
+ </td>
997
+ </tr>
998
+ </table>
999
+ </div>
1000
+
1001
+ <div class="method_details ">
1002
+ <h3 class="signature " id="file_path_list-instance_method">
1003
+
1004
+ #<strong>file_path_list</strong> &#x21d2; <tt>Array&lt;String&gt;</tt>
1005
+
1006
+
1007
+
1008
+
1009
+
1010
+ </h3><div class="docstring">
1011
+ <div class="discussion">
1012
+
1013
+ <p>Local configuration file path list. It will prioritize from first to last.</p>
1014
+
1015
+
1016
+ </div>
1017
+ </div>
1018
+ <div class="tags">
1019
+
1020
+ <p class="tag_title">Returns:</p>
1021
+ <ul class="return">
1022
+
1023
+ <li>
1024
+
1025
+
1026
+ <span class='type'>(<tt>Array&lt;String&gt;</tt>)</span>
1027
+
1028
+
1029
+
1030
+ &mdash;
1031
+ <div class='inline'>
1032
+ <p>Configuration local file path.</p>
1033
+ </div>
1034
+
1035
+ </li>
1036
+
1037
+ </ul>
1038
+
1039
+ </div><table class="source_code">
1040
+ <tr>
1041
+ <td>
1042
+ <pre class="lines">
1043
+
1044
+
1045
+ 87
1046
+ 88
1047
+ 89</pre>
1048
+ </td>
1049
+ <td>
1050
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/config/local.rb', line 87</span>
1051
+
1052
+ <span class='kw'>def</span> <span class='id identifier rubyid_file_path_list'>file_path_list</span>
1053
+ <span class='ivar'>@file_path_list</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_default_file_path_list'>default_file_path_list</span>
1054
+ <span class='kw'>end</span></pre>
1055
+ </td>
1056
+ </tr>
1057
+ </table>
1058
+ </div>
1059
+
1060
+ <div class="method_details ">
1061
+ <h3 class="signature " id="load-instance_method">
1062
+
1063
+ #<strong>load</strong>(opts = {}) &#x21d2; <tt>Object</tt>
1064
+
1065
+
1066
+
1067
+
1068
+
1069
+ </h3><div class="docstring">
1070
+ <div class="discussion">
1071
+
1072
+ <p>Loads a local configuration file.</p>
1073
+
1074
+
1075
+ </div>
1076
+ </div>
1077
+ <div class="tags">
1078
+ <p class="tag_title">Parameters:</p>
1079
+ <ul class="param">
1080
+
1081
+ <li>
1082
+
1083
+ <span class='name'>opts</span>
1084
+
1085
+
1086
+ <span class='type'>(<tt>Hash</tt>)</span>
1087
+
1088
+
1089
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
1090
+
1091
+
1092
+ &mdash;
1093
+ <div class='inline'>
1094
+ <p>({}) Configuration options.</p>
1095
+ </div>
1096
+
1097
+ </li>
1098
+
1099
+ </ul>
1100
+
1101
+
1102
+
1103
+
1104
+ <p class="tag_title">Options Hash (<tt>opts</tt>):</p>
1105
+ <ul class="option">
1106
+
1107
+ <li>
1108
+ <span class="name">:file_path</span>
1109
+ <span class="type">(<tt>String</tt>)</span>
1110
+ <span class="default">
1111
+
1112
+ &mdash; default:
1113
+ <tt>nil</tt>
1114
+
1115
+ </span>
1116
+
1117
+ &mdash; <div class='inline'>
1118
+ <p>Configuration file path to load (see #file_path for configuration default
1119
+ file.)</p>
1120
+ </div>
1121
+
1122
+ </li>
1123
+
1124
+ <li>
1125
+ <span class="name">:force</span>
1126
+ <span class="type">(<tt>Boolean</tt>)</span>
1127
+ <span class="default">
1128
+
1129
+ &mdash; default:
1130
+ <tt>false</tt>
1131
+
1132
+ </span>
1133
+
1134
+ &mdash; <div class='inline'>
1135
+ <p>Will reload configuration file when `true`.</p>
1136
+ </div>
1137
+
1138
+ </li>
1139
+
1140
+ </ul>
1141
+
1142
+
1143
+
1144
+ </div><table class="source_code">
1145
+ <tr>
1146
+ <td>
1147
+ <pre class="lines">
1148
+
1149
+
1150
+ 98
1151
+ 99
1152
+ 100
1153
+ 101
1154
+ 102
1155
+ 103
1156
+ 104
1157
+ 105</pre>
1158
+ </td>
1159
+ <td>
1160
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/config/local.rb', line 98</span>
1161
+
1162
+ <span class='kw'>def</span> <span class='id identifier rubyid_load'>load</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
1163
+ <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span>
1164
+ <span class='label'>file_path:</span> <span class='kw'>nil</span><span class='comma'>,</span>
1165
+ <span class='label'>force:</span> <span class='kw'>false</span>
1166
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span> <span class='id identifier rubyid_opts'>opts</span>
1167
+ <span class='ivar'>@file_path</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:file_path</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_file_path'>file_path</span>
1168
+ <span class='ivar'>@local</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_load_file'>load_file</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
1169
+ <span class='kw'>end</span></pre>
1170
+ </td>
1171
+ </tr>
1172
+ </table>
1173
+ </div>
1174
+
1175
+ <div class="method_details ">
1176
+ <h3 class="signature " id="lookup_file_path-instance_method">
1177
+
1178
+ #<strong>lookup_file_path</strong> &#x21d2; <tt>String</tt><sup>?</sup>
1179
+
1180
+
1181
+
1182
+
1183
+
1184
+ </h3><div class="docstring">
1185
+ <div class="discussion">
1186
+
1187
+ <p>Lookup #file_path_list for the first valid file.</p>
1188
+
1189
+
1190
+ </div>
1191
+ </div>
1192
+ <div class="tags">
1193
+
1194
+ <p class="tag_title">Returns:</p>
1195
+ <ul class="return">
1196
+
1197
+ <li>
1198
+
1199
+
1200
+ <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
1201
+
1202
+
1203
+
1204
+ &mdash;
1205
+ <div class='inline'>
1206
+ <p>Valid file path or `nil`.</p>
1207
+ </div>
1208
+
1209
+ </li>
1210
+
1211
+ </ul>
1212
+
1213
+ </div><table class="source_code">
1214
+ <tr>
1215
+ <td>
1216
+ <pre class="lines">
1217
+
1218
+
1219
+ 68
1220
+ 69
1221
+ 70
1222
+ 71
1223
+ 72
1224
+ 73
1225
+ 74</pre>
1226
+ </td>
1227
+ <td>
1228
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/config/local.rb', line 68</span>
1229
+
1230
+ <span class='kw'>def</span> <span class='id identifier rubyid_lookup_file_path'>lookup_file_path</span>
1231
+ <span class='id identifier rubyid_file_path_list'>file_path_list</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_candidate_file_path'>candidate_file_path</span><span class='op'>|</span>
1232
+ <span class='kw'>next</span> <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_file?'>file?</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_candidate_file_path'>candidate_file_path</span><span class='rparen'>)</span><span class='rparen'>)</span>
1233
+ <span class='kw'>return</span> <span class='id identifier rubyid_candidate_file_path'>candidate_file_path</span>
1234
+ <span class='kw'>end</span>
1235
+ <span class='kw'>nil</span>
1236
+ <span class='kw'>end</span></pre>
1237
+ </td>
1238
+ </tr>
1239
+ </table>
1240
+ </div>
1241
+
1242
+ <div class="method_details ">
1243
+ <h3 class="signature " id="reload!-instance_method">
1244
+
1245
+ #<strong>reload!</strong> &#x21d2; <tt>Object</tt>
1246
+
1247
+
1248
+
1249
+
1250
+
1251
+ </h3><div class="docstring">
1252
+ <div class="discussion">
1253
+
1254
+ <p>Reloads local configuration file.</p>
1255
+
1256
+
1257
+ </div>
1258
+ </div>
1259
+ <div class="tags">
1260
+
1261
+
1262
+ </div><table class="source_code">
1263
+ <tr>
1264
+ <td>
1265
+ <pre class="lines">
1266
+
1267
+
1268
+ 108
1269
+ 109
1270
+ 110</pre>
1271
+ </td>
1272
+ <td>
1273
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/config/local.rb', line 108</span>
1274
+
1275
+ <span class='kw'>def</span> <span class='id identifier rubyid_reload!'>reload!</span>
1276
+ <span class='id identifier rubyid_load'>load</span> <span class='label'>force:</span> <span class='kw'>true</span>
1277
+ <span class='kw'>end</span></pre>
1278
+ </td>
1279
+ </tr>
1280
+ </table>
1281
+ </div>
1282
+
1283
+ <div class="method_details ">
1284
+ <h3 class="signature " id="reset!-instance_method">
1285
+
1286
+ #<strong>reset!</strong> &#x21d2; <tt>Object</tt>
1287
+
1288
+
1289
+
1290
+
1291
+
1292
+ </h3><div class="docstring">
1293
+ <div class="discussion">
1294
+
1295
+ <p>Reset instance to lookup for valid files from #file_path_list and load</p>
1296
+
1297
+ <pre class="code ruby"><code class="ruby">the first valid configuration file found.
1298
+ </code></pre>
1299
+
1300
+
1301
+ </div>
1302
+ </div>
1303
+ <div class="tags">
1304
+
1305
+
1306
+ </div><table class="source_code">
1307
+ <tr>
1308
+ <td>
1309
+ <pre class="lines">
1310
+
1311
+
1312
+ 114
1313
+ 115
1314
+ 116
1315
+ 117</pre>
1316
+ </td>
1317
+ <td>
1318
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/config/local.rb', line 114</span>
1319
+
1320
+ <span class='kw'>def</span> <span class='id identifier rubyid_reset!'>reset!</span>
1321
+ <span class='ivar'>@file_path</span> <span class='op'>=</span> <span class='kw'>nil</span>
1322
+ <span class='id identifier rubyid_load'>load</span> <span class='label'>force:</span> <span class='kw'>true</span>
1323
+ <span class='kw'>end</span></pre>
1324
+ </td>
1325
+ </tr>
1326
+ </table>
1327
+ </div>
1328
+
1329
+ <div class="method_details ">
1330
+ <h3 class="signature " id="to_h-instance_method">
1331
+
1332
+ #<strong>to_h</strong> &#x21d2; <tt>Hash</tt>
1333
+
1334
+
1335
+
1336
+
1337
+
1338
+ </h3><div class="docstring">
1339
+ <div class="discussion">
1340
+
1341
+ <p>Convert to hash.</p>
1342
+
1343
+
1344
+ </div>
1345
+ </div>
1346
+ <div class="tags">
1347
+
1348
+ <p class="tag_title">Returns:</p>
1349
+ <ul class="return">
1350
+
1351
+ <li>
1352
+
1353
+
1354
+ <span class='type'>(<tt>Hash</tt>)</span>
1355
+
1356
+
1357
+
1358
+ </li>
1359
+
1360
+ </ul>
1361
+
1362
+ </div><table class="source_code">
1363
+ <tr>
1364
+ <td>
1365
+ <pre class="lines">
1366
+
1367
+
1368
+ 52
1369
+ 53
1370
+ 54</pre>
1371
+ </td>
1372
+ <td>
1373
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/config/local.rb', line 52</span>
1374
+
1375
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_h'>to_h</span>
1376
+ <span class='id identifier rubyid_local'>local</span>
1377
+ <span class='kw'>end</span></pre>
1378
+ </td>
1379
+ </tr>
1380
+ </table>
1381
+ </div>
1382
+
1383
+ </div>
1384
+
1385
+ </div>
1386
+
1387
+ <div id="footer">
1388
+ Generated on Wed Dec 4 23:02:32 2019 by
1389
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1390
+ 0.9.20 (ruby-2.5.3).
1391
+ </div>
1392
+
1393
+ </div>
1394
+ </body>
1395
+ </html>