configatron 2.1.4 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/classes/Configatron/ProtectedParameter.html +6 -6
- data/doc/classes/Configatron/Store.html +85 -85
- data/doc/classes/Configatron.html +62 -14
- data/doc/classes/Kernel.html +6 -6
- data/doc/created.rid +1 -1
- data/doc/files/README.html +1 -1
- data/doc/files/lib/configatron/configatron_rb.html +1 -1
- data/doc/files/lib/configatron/errors_rb.html +1 -1
- data/doc/files/lib/configatron/kernel_rb.html +1 -1
- data/doc/files/lib/configatron/store_rb.html +1 -1
- data/doc/files/lib/configatron_rb.html +1 -1
- data/doc/fr_method_index.html +18 -16
- data/lib/configatron/configatron.rb +15 -7
- data/spec/lib/configatron_spec.rb +9 -0
- metadata +2 -2
@@ -86,7 +86,7 @@
|
|
86
86
|
<h3 class="section-bar">Methods</h3>
|
87
87
|
|
88
88
|
<div class="name-list">
|
89
|
-
<a href="#
|
89
|
+
<a href="#M000020">intialize</a>
|
90
90
|
</div>
|
91
91
|
</div>
|
92
92
|
|
@@ -108,19 +108,19 @@
|
|
108
108
|
<div id="methods">
|
109
109
|
<h3 class="section-bar">Public Instance methods</h3>
|
110
110
|
|
111
|
-
<div id="method-
|
112
|
-
<a name="
|
111
|
+
<div id="method-M000020" class="method-detail">
|
112
|
+
<a name="M000020"></a>
|
113
113
|
|
114
114
|
<div class="method-heading">
|
115
|
-
<a href="#
|
115
|
+
<a href="#M000020" class="method-signature">
|
116
116
|
<span class="method-name">intialize</span><span class="method-args">(name)</span>
|
117
117
|
</a>
|
118
118
|
</div>
|
119
119
|
|
120
120
|
<div class="method-description">
|
121
121
|
<p><a class="source-toggle" href="#"
|
122
|
-
onclick="toggleCode('
|
123
|
-
<div class="method-source-code" id="
|
122
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
123
|
+
<div class="method-source-code" id="M000020-source">
|
124
124
|
<pre>
|
125
125
|
<span class="ruby-comment cmt"># File lib/configatron/errors.rb, line 3</span>
|
126
126
|
3: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">intialize</span>(<span class="ruby-identifier">name</span>)
|
@@ -86,20 +86,20 @@
|
|
86
86
|
<h3 class="section-bar">Methods</h3>
|
87
87
|
|
88
88
|
<div class="name-list">
|
89
|
-
<a href="#
|
90
|
-
<a href="#
|
91
|
-
<a href="#
|
92
|
-
<a href="#
|
93
|
-
<a href="#
|
94
|
-
<a href="#
|
95
|
-
<a href="#
|
96
|
-
<a href="#
|
97
|
-
<a href="#
|
98
|
-
<a href="#
|
99
|
-
<a href="#
|
100
|
-
<a href="#
|
101
|
-
<a href="#
|
102
|
-
<a href="#
|
89
|
+
<a href="#M000009">configure_from_hash</a>
|
90
|
+
<a href="#M000010">configure_from_yaml</a>
|
91
|
+
<a href="#M000019">deep_clone</a>
|
92
|
+
<a href="#M000008">inspect</a>
|
93
|
+
<a href="#M000006">new</a>
|
94
|
+
<a href="#M000011">nil?</a>
|
95
|
+
<a href="#M000015">protect</a>
|
96
|
+
<a href="#M000016">protect_all!</a>
|
97
|
+
<a href="#M000013">remove</a>
|
98
|
+
<a href="#M000012">retrieve</a>
|
99
|
+
<a href="#M000014">set_default</a>
|
100
|
+
<a href="#M000007">to_hash</a>
|
101
|
+
<a href="#M000017">unprotect</a>
|
102
|
+
<a href="#M000018">unprotect_all!</a>
|
103
103
|
</div>
|
104
104
|
</div>
|
105
105
|
|
@@ -121,11 +121,11 @@
|
|
121
121
|
<div id="methods">
|
122
122
|
<h3 class="section-bar">Public Class methods</h3>
|
123
123
|
|
124
|
-
<div id="method-
|
125
|
-
<a name="
|
124
|
+
<div id="method-M000006" class="method-detail">
|
125
|
+
<a name="M000006"></a>
|
126
126
|
|
127
127
|
<div class="method-heading">
|
128
|
-
<a href="#
|
128
|
+
<a href="#M000006" class="method-signature">
|
129
129
|
<span class="method-name">new</span><span class="method-args">(options = {}, name = nil, parent = nil)</span>
|
130
130
|
</a>
|
131
131
|
</div>
|
@@ -135,8 +135,8 @@
|
|
135
135
|
Takes an optional Hash of parameters
|
136
136
|
</p>
|
137
137
|
<p><a class="source-toggle" href="#"
|
138
|
-
onclick="toggleCode('
|
139
|
-
<div class="method-source-code" id="
|
138
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
139
|
+
<div class="method-source-code" id="M000006-source">
|
140
140
|
<pre>
|
141
141
|
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 5</span>
|
142
142
|
5: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span> = {}, <span class="ruby-identifier">name</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">parent</span> = <span class="ruby-keyword kw">nil</span>)
|
@@ -153,11 +153,11 @@ Takes an optional Hash of parameters
|
|
153
153
|
|
154
154
|
<h3 class="section-bar">Public Instance methods</h3>
|
155
155
|
|
156
|
-
<div id="method-
|
157
|
-
<a name="
|
156
|
+
<div id="method-M000009" class="method-detail">
|
157
|
+
<a name="M000009"></a>
|
158
158
|
|
159
159
|
<div class="method-heading">
|
160
|
-
<a href="#
|
160
|
+
<a href="#M000009" class="method-signature">
|
161
161
|
<span class="method-name">configure_from_hash</span><span class="method-args">(options)</span>
|
162
162
|
</a>
|
163
163
|
</div>
|
@@ -167,8 +167,8 @@ Takes an optional Hash of parameters
|
|
167
167
|
Allows for the configuration of the system via a Hash
|
168
168
|
</p>
|
169
169
|
<p><a class="source-toggle" href="#"
|
170
|
-
onclick="toggleCode('
|
171
|
-
<div class="method-source-code" id="
|
170
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
171
|
+
<div class="method-source-code" id="M000009-source">
|
172
172
|
<pre>
|
173
173
|
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 50</span>
|
174
174
|
50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configure_from_hash</span>(<span class="ruby-identifier">options</span>)
|
@@ -179,11 +179,11 @@ Allows for the configuration of the system via a Hash
|
|
179
179
|
</div>
|
180
180
|
</div>
|
181
181
|
|
182
|
-
<div id="method-
|
183
|
-
<a name="
|
182
|
+
<div id="method-M000010" class="method-detail">
|
183
|
+
<a name="M000010"></a>
|
184
184
|
|
185
185
|
<div class="method-heading">
|
186
|
-
<a href="#
|
186
|
+
<a href="#M000010" class="method-signature">
|
187
187
|
<span class="method-name">configure_from_yaml</span><span class="method-args">(path, opts = {})</span>
|
188
188
|
</a>
|
189
189
|
</div>
|
@@ -195,8 +195,8 @@ to the YAML file. Also takes an optional parameter, <tt>:hash</tt>, that
|
|
195
195
|
indicates a specific hash that should be loaded from the file.
|
196
196
|
</p>
|
197
197
|
<p><a class="source-toggle" href="#"
|
198
|
-
onclick="toggleCode('
|
199
|
-
<div class="method-source-code" id="
|
198
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
199
|
+
<div class="method-source-code" id="M000010-source">
|
200
200
|
<pre>
|
201
201
|
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 58</span>
|
202
202
|
58: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configure_from_yaml</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">opts</span> = {})
|
@@ -213,11 +213,11 @@ indicates a specific hash that should be loaded from the file.
|
|
213
213
|
</div>
|
214
214
|
</div>
|
215
215
|
|
216
|
-
<div id="method-
|
217
|
-
<a name="
|
216
|
+
<div id="method-M000019" class="method-detail">
|
217
|
+
<a name="M000019"></a>
|
218
218
|
|
219
219
|
<div class="method-heading">
|
220
|
-
<a href="#
|
220
|
+
<a href="#M000019" class="method-signature">
|
221
221
|
<span class="method-name">deep_clone</span><span class="method-args">( obj=self, cloned={} )</span>
|
222
222
|
</a>
|
223
223
|
</div>
|
@@ -265,8 +265,8 @@ href="http://simplypowerful.1984.cz/goodlibs/1.2006.05.23">simplypowerful.1984.c
|
|
265
265
|
either the dual license version in 2003, or any later version.
|
266
266
|
</pre>
|
267
267
|
<p><a class="source-toggle" href="#"
|
268
|
-
onclick="toggleCode('
|
269
|
-
<div class="method-source-code" id="
|
268
|
+
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
269
|
+
<div class="method-source-code" id="M000019-source">
|
270
270
|
<pre>
|
271
271
|
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 176</span>
|
272
272
|
176: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">deep_clone</span>( <span class="ruby-identifier">obj</span>=<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">cloned</span>={} )
|
@@ -305,19 +305,19 @@ href="http://simplypowerful.1984.cz/goodlibs/1.2006.05.23">simplypowerful.1984.c
|
|
305
305
|
</div>
|
306
306
|
</div>
|
307
307
|
|
308
|
-
<div id="method-
|
309
|
-
<a name="
|
308
|
+
<div id="method-M000008" class="method-detail">
|
309
|
+
<a name="M000008"></a>
|
310
310
|
|
311
311
|
<div class="method-heading">
|
312
|
-
<a href="#
|
312
|
+
<a href="#M000008" class="method-signature">
|
313
313
|
<span class="method-name">inspect</span><span class="method-args">()</span>
|
314
314
|
</a>
|
315
315
|
</div>
|
316
316
|
|
317
317
|
<div class="method-description">
|
318
318
|
<p><a class="source-toggle" href="#"
|
319
|
-
onclick="toggleCode('
|
320
|
-
<div class="method-source-code" id="
|
319
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
320
|
+
<div class="method-source-code" id="M000008-source">
|
321
321
|
<pre>
|
322
322
|
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 18</span>
|
323
323
|
18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
|
@@ -355,11 +355,11 @@ href="http://simplypowerful.1984.cz/goodlibs/1.2006.05.23">simplypowerful.1984.c
|
|
355
355
|
</div>
|
356
356
|
</div>
|
357
357
|
|
358
|
-
<div id="method-
|
359
|
-
<a name="
|
358
|
+
<div id="method-M000011" class="method-detail">
|
359
|
+
<a name="M000011"></a>
|
360
360
|
|
361
361
|
<div class="method-heading">
|
362
|
-
<a href="#
|
362
|
+
<a href="#M000011" class="method-signature">
|
363
363
|
<span class="method-name">nil?</span><span class="method-args">()</span>
|
364
364
|
</a>
|
365
365
|
</div>
|
@@ -369,8 +369,8 @@ href="http://simplypowerful.1984.cz/goodlibs/1.2006.05.23">simplypowerful.1984.c
|
|
369
369
|
Returns true if there are no configuration parameters
|
370
370
|
</p>
|
371
371
|
<p><a class="source-toggle" href="#"
|
372
|
-
onclick="toggleCode('
|
373
|
-
<div class="method-source-code" id="
|
372
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
373
|
+
<div class="method-source-code" id="M000011-source">
|
374
374
|
<pre>
|
375
375
|
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 69</span>
|
376
376
|
69: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nil?</span>
|
@@ -381,11 +381,11 @@ Returns true if there are no configuration parameters
|
|
381
381
|
</div>
|
382
382
|
</div>
|
383
383
|
|
384
|
-
<div id="method-
|
385
|
-
<a name="
|
384
|
+
<div id="method-M000015" class="method-detail">
|
385
|
+
<a name="M000015"></a>
|
386
386
|
|
387
387
|
<div class="method-heading">
|
388
|
-
<a href="#
|
388
|
+
<a href="#M000015" class="method-signature">
|
389
389
|
<span class="method-name">protect</span><span class="method-args">(name)</span>
|
390
390
|
</a>
|
391
391
|
</div>
|
@@ -397,8 +397,8 @@ Prevents a parameter from being reassigned. If called on a
|
|
397
397
|
well.
|
398
398
|
</p>
|
399
399
|
<p><a class="source-toggle" href="#"
|
400
|
-
onclick="toggleCode('
|
401
|
-
<div class="method-source-code" id="
|
400
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
401
|
+
<div class="method-source-code" id="M000015-source">
|
402
402
|
<pre>
|
403
403
|
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 113</span>
|
404
404
|
113: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">protect</span>(<span class="ruby-identifier">name</span>)
|
@@ -409,11 +409,11 @@ well.
|
|
409
409
|
</div>
|
410
410
|
</div>
|
411
411
|
|
412
|
-
<div id="method-
|
413
|
-
<a name="
|
412
|
+
<div id="method-M000016" class="method-detail">
|
413
|
+
<a name="M000016"></a>
|
414
414
|
|
415
415
|
<div class="method-heading">
|
416
|
-
<a href="#
|
416
|
+
<a href="#M000016" class="method-signature">
|
417
417
|
<span class="method-name">protect_all!</span><span class="method-args">()</span>
|
418
418
|
</a>
|
419
419
|
</div>
|
@@ -423,8 +423,8 @@ well.
|
|
423
423
|
Prevents all parameters from being reassigned.
|
424
424
|
</p>
|
425
425
|
<p><a class="source-toggle" href="#"
|
426
|
-
onclick="toggleCode('
|
427
|
-
<div class="method-source-code" id="
|
426
|
+
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
427
|
+
<div class="method-source-code" id="M000016-source">
|
428
428
|
<pre>
|
429
429
|
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 118</span>
|
430
430
|
118: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">protect_all!</span>
|
@@ -440,11 +440,11 @@ Prevents all parameters from being reassigned.
|
|
440
440
|
</div>
|
441
441
|
</div>
|
442
442
|
|
443
|
-
<div id="method-
|
444
|
-
<a name="
|
443
|
+
<div id="method-M000013" class="method-detail">
|
444
|
+
<a name="M000013"></a>
|
445
445
|
|
446
446
|
<div class="method-heading">
|
447
|
-
<a href="#
|
447
|
+
<a href="#M000013" class="method-signature">
|
448
448
|
<span class="method-name">remove</span><span class="method-args">(name)</span>
|
449
449
|
</a>
|
450
450
|
</div>
|
@@ -452,11 +452,11 @@ Prevents all parameters from being reassigned.
|
|
452
452
|
<div class="method-description">
|
453
453
|
<p>
|
454
454
|
Removes a parameter. In the case of a nested parameter it will <a
|
455
|
-
href="Store.html#
|
455
|
+
href="Store.html#M000013">remove</a> all below it.
|
456
456
|
</p>
|
457
457
|
<p><a class="source-toggle" href="#"
|
458
|
-
onclick="toggleCode('
|
459
|
-
<div class="method-source-code" id="
|
458
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
459
|
+
<div class="method-source-code" id="M000013-source">
|
460
460
|
<pre>
|
461
461
|
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 81</span>
|
462
462
|
81: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove</span>(<span class="ruby-identifier">name</span>)
|
@@ -467,11 +467,11 @@ href="Store.html#M000011">remove</a> all below it.
|
|
467
467
|
</div>
|
468
468
|
</div>
|
469
469
|
|
470
|
-
<div id="method-
|
471
|
-
<a name="
|
470
|
+
<div id="method-M000012" class="method-detail">
|
471
|
+
<a name="M000012"></a>
|
472
472
|
|
473
473
|
<div class="method-heading">
|
474
|
-
<a href="#
|
474
|
+
<a href="#M000012" class="method-signature">
|
475
475
|
<span class="method-name">retrieve</span><span class="method-args">(name, default_value = nil)</span>
|
476
476
|
</a>
|
477
477
|
</div>
|
@@ -482,8 +482,8 @@ Retrieves a certain parameter and if that parameter doesn‘t exist it
|
|
482
482
|
will return the default_value specified.
|
483
483
|
</p>
|
484
484
|
<p><a class="source-toggle" href="#"
|
485
|
-
onclick="toggleCode('
|
486
|
-
<div class="method-source-code" id="
|
485
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
486
|
+
<div class="method-source-code" id="M000012-source">
|
487
487
|
<pre>
|
488
488
|
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 75</span>
|
489
489
|
75: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">retrieve</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">default_value</span> = <span class="ruby-keyword kw">nil</span>)
|
@@ -494,11 +494,11 @@ will return the default_value specified.
|
|
494
494
|
</div>
|
495
495
|
</div>
|
496
496
|
|
497
|
-
<div id="method-
|
498
|
-
<a name="
|
497
|
+
<div id="method-M000014" class="method-detail">
|
498
|
+
<a name="M000014"></a>
|
499
499
|
|
500
500
|
<div class="method-heading">
|
501
|
-
<a href="#
|
501
|
+
<a href="#M000014" class="method-signature">
|
502
502
|
<span class="method-name">set_default</span><span class="method-args">(name, default_value)</span>
|
503
503
|
</a>
|
504
504
|
</div>
|
@@ -509,8 +509,8 @@ Sets a ‘default’ value. If there is already a value specified
|
|
509
509
|
it won‘t set the value.
|
510
510
|
</p>
|
511
511
|
<p><a class="source-toggle" href="#"
|
512
|
-
onclick="toggleCode('
|
513
|
-
<div class="method-source-code" id="
|
512
|
+
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
513
|
+
<div class="method-source-code" id="M000014-source">
|
514
514
|
<pre>
|
515
515
|
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 87</span>
|
516
516
|
87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_default</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">default_value</span>)
|
@@ -523,11 +523,11 @@ it won‘t set the value.
|
|
523
523
|
</div>
|
524
524
|
</div>
|
525
525
|
|
526
|
-
<div id="method-
|
527
|
-
<a name="
|
526
|
+
<div id="method-M000007" class="method-detail">
|
527
|
+
<a name="M000007"></a>
|
528
528
|
|
529
529
|
<div class="method-heading">
|
530
|
-
<a href="#
|
530
|
+
<a href="#M000007" class="method-signature">
|
531
531
|
<span class="method-name">to_hash</span><span class="method-args">()</span>
|
532
532
|
</a>
|
533
533
|
</div>
|
@@ -537,8 +537,8 @@ it won‘t set the value.
|
|
537
537
|
Returns a Hash representing the configurations
|
538
538
|
</p>
|
539
539
|
<p><a class="source-toggle" href="#"
|
540
|
-
onclick="toggleCode('
|
541
|
-
<div class="method-source-code" id="
|
540
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
541
|
+
<div class="method-source-code" id="M000007-source">
|
542
542
|
<pre>
|
543
543
|
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 14</span>
|
544
544
|
14: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_hash</span>
|
@@ -549,11 +549,11 @@ Returns a Hash representing the configurations
|
|
549
549
|
</div>
|
550
550
|
</div>
|
551
551
|
|
552
|
-
<div id="method-
|
553
|
-
<a name="
|
552
|
+
<div id="method-M000017" class="method-detail">
|
553
|
+
<a name="M000017"></a>
|
554
554
|
|
555
555
|
<div class="method-heading">
|
556
|
-
<a href="#
|
556
|
+
<a href="#M000017" class="method-signature">
|
557
557
|
<span class="method-name">unprotect</span><span class="method-args">(name)</span>
|
558
558
|
</a>
|
559
559
|
</div>
|
@@ -563,8 +563,8 @@ Returns a Hash representing the configurations
|
|
563
563
|
Removes the protection of a parameter.
|
564
564
|
</p>
|
565
565
|
<p><a class="source-toggle" href="#"
|
566
|
-
onclick="toggleCode('
|
567
|
-
<div class="method-source-code" id="
|
566
|
+
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
567
|
+
<div class="method-source-code" id="M000017-source">
|
568
568
|
<pre>
|
569
569
|
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 128</span>
|
570
570
|
128: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unprotect</span>(<span class="ruby-identifier">name</span>)
|
@@ -575,19 +575,19 @@ Removes the protection of a parameter.
|
|
575
575
|
</div>
|
576
576
|
</div>
|
577
577
|
|
578
|
-
<div id="method-
|
579
|
-
<a name="
|
578
|
+
<div id="method-M000018" class="method-detail">
|
579
|
+
<a name="M000018"></a>
|
580
580
|
|
581
581
|
<div class="method-heading">
|
582
|
-
<a href="#
|
582
|
+
<a href="#M000018" class="method-signature">
|
583
583
|
<span class="method-name">unprotect_all!</span><span class="method-args">()</span>
|
584
584
|
</a>
|
585
585
|
</div>
|
586
586
|
|
587
587
|
<div class="method-description">
|
588
588
|
<p><a class="source-toggle" href="#"
|
589
|
-
onclick="toggleCode('
|
590
|
-
<div class="method-source-code" id="
|
589
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
590
|
+
<div class="method-source-code" id="M000018-source">
|
591
591
|
<pre>
|
592
592
|
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 132</span>
|
593
593
|
132: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unprotect_all!</span>
|
@@ -97,6 +97,8 @@
|
|
97
97
|
<a href="#M000001">method_missing</a>
|
98
98
|
<a href="#M000002">reset!</a>
|
99
99
|
<a href="#M000003">temp</a>
|
100
|
+
<a href="#M000005">temp_end</a>
|
101
|
+
<a href="#M000004">temp_start</a>
|
100
102
|
</div>
|
101
103
|
</div>
|
102
104
|
|
@@ -207,20 +209,66 @@ original settings are reinstated.
|
|
207
209
|
<pre>
|
208
210
|
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 25</span>
|
209
211
|
25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">temp</span>(<span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
|
210
|
-
26: <span class="ruby-
|
211
|
-
27:
|
212
|
-
28:
|
213
|
-
29:
|
214
|
-
30:
|
215
|
-
31:
|
216
|
-
32: <span class="ruby-
|
217
|
-
33: <span class="ruby-keyword kw">
|
218
|
-
34:
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
212
|
+
26: <span class="ruby-keyword kw">begin</span>
|
213
|
+
27: <span class="ruby-identifier">temp_start</span>(<span class="ruby-identifier">options</span>)
|
214
|
+
28: <span class="ruby-keyword kw">yield</span>
|
215
|
+
29: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
216
|
+
30: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
217
|
+
31: <span class="ruby-keyword kw">ensure</span>
|
218
|
+
32: <span class="ruby-identifier">temp_end</span>
|
219
|
+
33: <span class="ruby-keyword kw">end</span>
|
220
|
+
34: <span class="ruby-keyword kw">end</span>
|
221
|
+
</pre>
|
222
|
+
</div>
|
223
|
+
</div>
|
224
|
+
</div>
|
225
|
+
|
226
|
+
<div id="method-M000005" class="method-detail">
|
227
|
+
<a name="M000005"></a>
|
228
|
+
|
229
|
+
<div class="method-heading">
|
230
|
+
<a href="#M000005" class="method-signature">
|
231
|
+
<span class="method-name">temp_end</span><span class="method-args">()</span>
|
232
|
+
</a>
|
233
|
+
</div>
|
234
|
+
|
235
|
+
<div class="method-description">
|
236
|
+
<p><a class="source-toggle" href="#"
|
237
|
+
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
238
|
+
<div class="method-source-code" id="M000005-source">
|
239
|
+
<pre>
|
240
|
+
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 44</span>
|
241
|
+
44: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">temp_end</span>
|
242
|
+
45: <span class="ruby-ivar">@_store</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-ivar">@_namespace</span>)
|
243
|
+
46: <span class="ruby-ivar">@_namespace</span> = <span class="ruby-identifier">:default</span>
|
244
|
+
47: <span class="ruby-keyword kw">end</span>
|
245
|
+
</pre>
|
246
|
+
</div>
|
247
|
+
</div>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
<div id="method-M000004" class="method-detail">
|
251
|
+
<a name="M000004"></a>
|
252
|
+
|
253
|
+
<div class="method-heading">
|
254
|
+
<a href="#M000004" class="method-signature">
|
255
|
+
<span class="method-name">temp_start</span><span class="method-args">(options = nil)</span>
|
256
|
+
</a>
|
257
|
+
</div>
|
258
|
+
|
259
|
+
<div class="method-description">
|
260
|
+
<p><a class="source-toggle" href="#"
|
261
|
+
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
262
|
+
<div class="method-source-code" id="M000004-source">
|
263
|
+
<pre>
|
264
|
+
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 36</span>
|
265
|
+
36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">temp_start</span>(<span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
|
266
|
+
37: <span class="ruby-ivar">@_namespace</span> = <span class="ruby-identifier">rand</span>
|
267
|
+
38: <span class="ruby-ivar">@_store</span>[<span class="ruby-ivar">@_namespace</span>] = <span class="ruby-ivar">@_store</span>[<span class="ruby-identifier">:default</span>].<span class="ruby-identifier">deep_clone</span>
|
268
|
+
39: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>
|
269
|
+
40: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">:configure_from_hash</span>, <span class="ruby-identifier">options</span>)
|
270
|
+
41: <span class="ruby-keyword kw">end</span>
|
271
|
+
42: <span class="ruby-keyword kw">end</span>
|
224
272
|
</pre>
|
225
273
|
</div>
|
226
274
|
</div>
|
data/doc/classes/Kernel.html
CHANGED
@@ -80,7 +80,7 @@
|
|
80
80
|
<h3 class="section-bar">Methods</h3>
|
81
81
|
|
82
82
|
<div class="name-list">
|
83
|
-
<a href="#
|
83
|
+
<a href="#M000021">configatron</a>
|
84
84
|
</div>
|
85
85
|
</div>
|
86
86
|
|
@@ -102,11 +102,11 @@
|
|
102
102
|
<div id="methods">
|
103
103
|
<h3 class="section-bar">Public Instance methods</h3>
|
104
104
|
|
105
|
-
<div id="method-
|
106
|
-
<a name="
|
105
|
+
<div id="method-M000021" class="method-detail">
|
106
|
+
<a name="M000021"></a>
|
107
107
|
|
108
108
|
<div class="method-heading">
|
109
|
-
<a href="#
|
109
|
+
<a href="#M000021" class="method-signature">
|
110
110
|
<span class="method-name">configatron</span><span class="method-args">()</span>
|
111
111
|
</a>
|
112
112
|
</div>
|
@@ -117,8 +117,8 @@ Provides access to the <a href="Configatron.html">Configatron</a> storage
|
|
117
117
|
system.
|
118
118
|
</p>
|
119
119
|
<p><a class="source-toggle" href="#"
|
120
|
-
onclick="toggleCode('
|
121
|
-
<div class="method-source-code" id="
|
120
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
121
|
+
<div class="method-source-code" id="M000021-source">
|
122
122
|
<pre>
|
123
123
|
<span class="ruby-comment cmt"># File lib/configatron/kernel.rb, line 4</span>
|
124
124
|
4: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configatron</span>
|
data/doc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Wed, 08 Oct 2008 08:34:31 -0400
|
data/doc/files/README.html
CHANGED
data/doc/fr_method_index.html
CHANGED
@@ -20,25 +20,27 @@
|
|
20
20
|
<div id="index">
|
21
21
|
<h1 class="section-bar">Methods</h1>
|
22
22
|
<div id="index-entries">
|
23
|
-
<a href="classes/Kernel.html#
|
24
|
-
<a href="classes/Configatron/Store.html#
|
25
|
-
<a href="classes/Configatron/Store.html#
|
26
|
-
<a href="classes/Configatron/Store.html#
|
27
|
-
<a href="classes/Configatron/Store.html#
|
28
|
-
<a href="classes/Configatron/ProtectedParameter.html#
|
23
|
+
<a href="classes/Kernel.html#M000021">configatron (Kernel)</a><br />
|
24
|
+
<a href="classes/Configatron/Store.html#M000009">configure_from_hash (Configatron::Store)</a><br />
|
25
|
+
<a href="classes/Configatron/Store.html#M000010">configure_from_yaml (Configatron::Store)</a><br />
|
26
|
+
<a href="classes/Configatron/Store.html#M000019">deep_clone (Configatron::Store)</a><br />
|
27
|
+
<a href="classes/Configatron/Store.html#M000008">inspect (Configatron::Store)</a><br />
|
28
|
+
<a href="classes/Configatron/ProtectedParameter.html#M000020">intialize (Configatron::ProtectedParameter)</a><br />
|
29
29
|
<a href="classes/Configatron.html#M000001">method_missing (Configatron)</a><br />
|
30
|
-
<a href="classes/Configatron/Store.html#
|
31
|
-
<a href="classes/Configatron/Store.html#
|
32
|
-
<a href="classes/Configatron/Store.html#
|
33
|
-
<a href="classes/Configatron/Store.html#
|
34
|
-
<a href="classes/Configatron/Store.html#
|
30
|
+
<a href="classes/Configatron/Store.html#M000006">new (Configatron::Store)</a><br />
|
31
|
+
<a href="classes/Configatron/Store.html#M000011">nil? (Configatron::Store)</a><br />
|
32
|
+
<a href="classes/Configatron/Store.html#M000015">protect (Configatron::Store)</a><br />
|
33
|
+
<a href="classes/Configatron/Store.html#M000016">protect_all! (Configatron::Store)</a><br />
|
34
|
+
<a href="classes/Configatron/Store.html#M000013">remove (Configatron::Store)</a><br />
|
35
35
|
<a href="classes/Configatron.html#M000002">reset! (Configatron)</a><br />
|
36
|
-
<a href="classes/Configatron/Store.html#
|
37
|
-
<a href="classes/Configatron/Store.html#
|
36
|
+
<a href="classes/Configatron/Store.html#M000012">retrieve (Configatron::Store)</a><br />
|
37
|
+
<a href="classes/Configatron/Store.html#M000014">set_default (Configatron::Store)</a><br />
|
38
38
|
<a href="classes/Configatron.html#M000003">temp (Configatron)</a><br />
|
39
|
-
<a href="classes/Configatron
|
40
|
-
<a href="classes/Configatron
|
41
|
-
<a href="classes/Configatron/Store.html#
|
39
|
+
<a href="classes/Configatron.html#M000005">temp_end (Configatron)</a><br />
|
40
|
+
<a href="classes/Configatron.html#M000004">temp_start (Configatron)</a><br />
|
41
|
+
<a href="classes/Configatron/Store.html#M000007">to_hash (Configatron::Store)</a><br />
|
42
|
+
<a href="classes/Configatron/Store.html#M000017">unprotect (Configatron::Store)</a><br />
|
43
|
+
<a href="classes/Configatron/Store.html#M000018">unprotect_all! (Configatron::Store)</a><br />
|
42
44
|
</div>
|
43
45
|
</div>
|
44
46
|
</body>
|
@@ -23,21 +23,29 @@ class Configatron
|
|
23
23
|
# the block gets called. At the end of the block, the temporary
|
24
24
|
# settings are deleted and the original settings are reinstated.
|
25
25
|
def temp(options = nil)
|
26
|
-
@_namespace = rand
|
27
|
-
@_store[@_namespace] = @_store[:default].deep_clone
|
28
26
|
begin
|
29
|
-
|
30
|
-
self.method_missing(:configure_from_hash, options)
|
31
|
-
end
|
27
|
+
temp_start(options)
|
32
28
|
yield
|
33
29
|
rescue Exception => e
|
34
30
|
raise e
|
35
31
|
ensure
|
36
|
-
|
37
|
-
|
32
|
+
temp_end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def temp_start(options = nil)
|
37
|
+
@_namespace = rand
|
38
|
+
@_store[@_namespace] = @_store[:default].deep_clone
|
39
|
+
if options
|
40
|
+
self.method_missing(:configure_from_hash, options)
|
38
41
|
end
|
39
42
|
end
|
40
43
|
|
44
|
+
def temp_end
|
45
|
+
@_store.delete(@_namespace)
|
46
|
+
@_namespace = :default
|
47
|
+
end
|
48
|
+
|
41
49
|
undef :inspect # :nodoc:
|
42
50
|
undef :nil? # :nodoc:
|
43
51
|
|
@@ -112,6 +112,15 @@ describe "configatron" do
|
|
112
112
|
configatron.letters.c.should be_nil
|
113
113
|
end
|
114
114
|
|
115
|
+
it 'should work the same as temp_start/temp_end' do
|
116
|
+
configatron.one = 1
|
117
|
+
configatron.temp_start
|
118
|
+
configatron.one = 'ONE'
|
119
|
+
configatron.one.should == 'ONE'
|
120
|
+
configatron.temp_end
|
121
|
+
configatron.one.should == 1
|
122
|
+
end
|
123
|
+
|
115
124
|
end
|
116
125
|
|
117
126
|
describe 'configure_from_hash' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configatron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- markbates
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-10-
|
12
|
+
date: 2008-10-08 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|