configatron 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/classes/Configatron/Store.html +100 -99
- 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/lib/configatron/store.rb +2 -1
- data/spec/lib/configatron_spec.rb +5 -0
- metadata +2 -2
@@ -137,12 +137,13 @@ Takes an optional Hash of parameters
|
|
137
137
|
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
138
138
|
<div class="method-source-code" id="M000004-source">
|
139
139
|
<pre>
|
140
|
-
|
141
|
-
5: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span> = {})
|
142
|
-
6: <span class="ruby-ivar">@_store</span> = {}
|
143
|
-
7: <span class="ruby-identifier">configure_from_hash</span>(<span class="ruby-identifier">options</span>)
|
144
|
-
8: <span class="ruby-ivar">@_protected</span> = []
|
145
|
-
9:
|
140
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 5</span>
|
141
|
+
5: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span> = {})
|
142
|
+
6: <span class="ruby-ivar">@_store</span> = {}
|
143
|
+
7: <span class="ruby-identifier">configure_from_hash</span>(<span class="ruby-identifier">options</span>)
|
144
|
+
8: <span class="ruby-ivar">@_protected</span> = []
|
145
|
+
9: <span class="ruby-comment cmt"># self.methods.each { |m| puts "m: #{m}"; configatron.protect(m.to_sym) }</span>
|
146
|
+
10: <span class="ruby-keyword kw">end</span>
|
146
147
|
</pre>
|
147
148
|
</div>
|
148
149
|
</div>
|
@@ -167,10 +168,10 @@ Allows for the configuration of the system via a Hash
|
|
167
168
|
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
168
169
|
<div class="method-source-code" id="M000006-source">
|
169
170
|
<pre>
|
170
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
171
|
-
|
172
|
-
|
173
|
-
|
171
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 22</span>
|
172
|
+
22: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configure_from_hash</span>(<span class="ruby-identifier">options</span>)
|
173
|
+
23: <span class="ruby-identifier">parse_options</span>(<span class="ruby-identifier">options</span>)
|
174
|
+
24: <span class="ruby-keyword kw">end</span>
|
174
175
|
</pre>
|
175
176
|
</div>
|
176
177
|
</div>
|
@@ -195,16 +196,16 @@ indicates a specific hash that should be loaded from the file.
|
|
195
196
|
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
196
197
|
<div class="method-source-code" id="M000007-source">
|
197
198
|
<pre>
|
198
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
199
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 30</span>
|
200
|
+
30: <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> = {})
|
201
|
+
31: <span class="ruby-keyword kw">begin</span>
|
202
|
+
32: <span class="ruby-identifier">yml</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">path</span>))
|
203
|
+
33: <span class="ruby-identifier">yml</span> = <span class="ruby-identifier">yml</span>[<span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:hash</span>]] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:hash</span>].<span class="ruby-identifier">nil?</span>
|
204
|
+
34: <span class="ruby-identifier">configure_from_hash</span>(<span class="ruby-identifier">yml</span>)
|
205
|
+
35: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
206
|
+
36: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
|
207
|
+
37: <span class="ruby-keyword kw">end</span>
|
208
|
+
38: <span class="ruby-keyword kw">end</span>
|
208
209
|
</pre>
|
209
210
|
</div>
|
210
211
|
</div>
|
@@ -265,38 +266,38 @@ href="http://simplypowerful.1984.cz/goodlibs/1.2006.05.23">simplypowerful.1984.c
|
|
265
266
|
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
266
267
|
<div class="method-source-code" id="M000016-source">
|
267
268
|
<pre>
|
268
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
269
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 148</span>
|
270
|
+
148: <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>={} )
|
271
|
+
149: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cloned</span>.<span class="ruby-identifier">has_key?</span>( <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">object_id</span> )
|
272
|
+
150: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">cloned</span>[<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">object_id</span>]
|
273
|
+
151: <span class="ruby-keyword kw">else</span>
|
274
|
+
152: <span class="ruby-keyword kw">begin</span>
|
275
|
+
153: <span class="ruby-identifier">cl</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">clone</span>
|
276
|
+
154: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
|
277
|
+
155: <span class="ruby-comment cmt"># unclonnable (TrueClass, Fixnum, ...)</span>
|
278
|
+
156: <span class="ruby-identifier">cloned</span>[<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">object_id</span>] = <span class="ruby-identifier">obj</span>
|
279
|
+
157: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">obj</span>
|
280
|
+
158: <span class="ruby-keyword kw">else</span>
|
281
|
+
159: <span class="ruby-identifier">cloned</span>[<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">object_id</span>] = <span class="ruby-identifier">cl</span>
|
282
|
+
160: <span class="ruby-identifier">cloned</span>[<span class="ruby-identifier">cl</span>.<span class="ruby-identifier">object_id</span>] = <span class="ruby-identifier">cl</span>
|
283
|
+
161: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cl</span>.<span class="ruby-identifier">is_a?</span>( <span class="ruby-constant">Hash</span> )
|
284
|
+
162: <span class="ruby-identifier">cl</span>.<span class="ruby-identifier">clone</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
285
|
+
163: <span class="ruby-identifier">cl</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">deep_clone</span>( <span class="ruby-identifier">v</span>, <span class="ruby-identifier">cloned</span> )
|
286
|
+
164: }
|
287
|
+
165: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">cl</span>.<span class="ruby-identifier">is_a?</span>( <span class="ruby-constant">Array</span> )
|
288
|
+
166: <span class="ruby-identifier">cl</span>.<span class="ruby-identifier">collect!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
289
|
+
167: <span class="ruby-identifier">deep_clone</span>( <span class="ruby-identifier">v</span>, <span class="ruby-identifier">cloned</span> )
|
290
|
+
168: }
|
291
|
+
169: <span class="ruby-keyword kw">end</span>
|
292
|
+
170: <span class="ruby-identifier">cl</span>.<span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">var</span><span class="ruby-operator">|</span>
|
293
|
+
171: <span class="ruby-identifier">v</span> = <span class="ruby-identifier">cl</span>.<span class="ruby-identifier">instance_eval</span>( <span class="ruby-identifier">var</span> )
|
294
|
+
172: <span class="ruby-identifier">v_cl</span> = <span class="ruby-identifier">deep_clone</span>( <span class="ruby-identifier">v</span>, <span class="ruby-identifier">cloned</span> )
|
295
|
+
173: <span class="ruby-identifier">cl</span>.<span class="ruby-identifier">instance_eval</span>( <span class="ruby-node">"#{var} = v_cl"</span> )
|
296
|
+
174: <span class="ruby-keyword kw">end</span>
|
297
|
+
175: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">cl</span>
|
298
|
+
176: <span class="ruby-keyword kw">end</span>
|
299
|
+
177: <span class="ruby-keyword kw">end</span>
|
300
|
+
178: <span class="ruby-keyword kw">end</span>
|
300
301
|
</pre>
|
301
302
|
</div>
|
302
303
|
</div>
|
@@ -319,10 +320,10 @@ Returns true if there are no configuration parameters
|
|
319
320
|
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
320
321
|
<div class="method-source-code" id="M000008-source">
|
321
322
|
<pre>
|
322
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
323
|
-
|
324
|
-
|
325
|
-
|
323
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 41</span>
|
324
|
+
41: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nil?</span>
|
325
|
+
42: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@_store</span>.<span class="ruby-identifier">empty?</span>
|
326
|
+
43: <span class="ruby-keyword kw">end</span>
|
326
327
|
</pre>
|
327
328
|
</div>
|
328
329
|
</div>
|
@@ -347,10 +348,10 @@ well.
|
|
347
348
|
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
348
349
|
<div class="method-source-code" id="M000012-source">
|
349
350
|
<pre>
|
350
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
351
|
-
|
352
|
-
|
353
|
-
|
351
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 85</span>
|
352
|
+
85: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">protect</span>(<span class="ruby-identifier">name</span>)
|
353
|
+
86: <span class="ruby-ivar">@_protected</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>
|
354
|
+
87: <span class="ruby-keyword kw">end</span>
|
354
355
|
</pre>
|
355
356
|
</div>
|
356
357
|
</div>
|
@@ -373,15 +374,15 @@ Prevents all parameters from being reassigned.
|
|
373
374
|
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
374
375
|
<div class="method-source-code" id="M000013-source">
|
375
376
|
<pre>
|
376
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
377
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 90</span>
|
378
|
+
90: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">protect_all!</span>
|
379
|
+
91: <span class="ruby-ivar">@_protected</span>.<span class="ruby-identifier">clear</span>
|
380
|
+
92: <span class="ruby-ivar">@_store</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
|
381
|
+
93: <span class="ruby-identifier">val</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">k</span>)
|
382
|
+
94: <span class="ruby-identifier">val</span>.<span class="ruby-identifier">protect_all!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Configatron</span><span class="ruby-operator">::</span><span class="ruby-constant">Store</span>
|
383
|
+
95: <span class="ruby-ivar">@_protected</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">k</span>
|
384
|
+
96: <span class="ruby-keyword kw">end</span>
|
385
|
+
97: <span class="ruby-keyword kw">end</span>
|
385
386
|
</pre>
|
386
387
|
</div>
|
387
388
|
</div>
|
@@ -405,10 +406,10 @@ href="Store.html#M000010">remove</a> all below it.
|
|
405
406
|
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
406
407
|
<div class="method-source-code" id="M000010-source">
|
407
408
|
<pre>
|
408
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
409
|
-
|
410
|
-
|
411
|
-
|
409
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 53</span>
|
410
|
+
53: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove</span>(<span class="ruby-identifier">name</span>)
|
411
|
+
54: <span class="ruby-ivar">@_store</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>)
|
412
|
+
55: <span class="ruby-keyword kw">end</span>
|
412
413
|
</pre>
|
413
414
|
</div>
|
414
415
|
</div>
|
@@ -432,10 +433,10 @@ will return the default_value specified.
|
|
432
433
|
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
433
434
|
<div class="method-source-code" id="M000009-source">
|
434
435
|
<pre>
|
435
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
436
|
-
|
437
|
-
|
438
|
-
|
436
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 47</span>
|
437
|
+
47: <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>)
|
438
|
+
48: <span class="ruby-ivar">@_store</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">default_value</span>
|
439
|
+
49: <span class="ruby-keyword kw">end</span>
|
439
440
|
</pre>
|
440
441
|
</div>
|
441
442
|
</div>
|
@@ -459,12 +460,12 @@ it won‘t set the value.
|
|
459
460
|
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
460
461
|
<div class="method-source-code" id="M000011-source">
|
461
462
|
<pre>
|
462
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
463
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 59</span>
|
464
|
+
59: <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>)
|
465
|
+
60: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@_store</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>]
|
466
|
+
61: <span class="ruby-ivar">@_store</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">parse_options</span>(<span class="ruby-identifier">default_value</span>)
|
467
|
+
62: <span class="ruby-keyword kw">end</span>
|
468
|
+
63: <span class="ruby-keyword kw">end</span>
|
468
469
|
</pre>
|
469
470
|
</div>
|
470
471
|
</div>
|
@@ -487,10 +488,10 @@ Returns a Hash representing the configurations
|
|
487
488
|
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
488
489
|
<div class="method-source-code" id="M000005-source">
|
489
490
|
<pre>
|
490
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
491
|
-
|
492
|
-
|
493
|
-
|
491
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 13</span>
|
492
|
+
13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_hash</span>
|
493
|
+
14: <span class="ruby-ivar">@_store</span>
|
494
|
+
15: <span class="ruby-keyword kw">end</span>
|
494
495
|
</pre>
|
495
496
|
</div>
|
496
497
|
</div>
|
@@ -513,10 +514,10 @@ Removes the protection of a parameter.
|
|
513
514
|
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
514
515
|
<div class="method-source-code" id="M000014-source">
|
515
516
|
<pre>
|
516
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
517
|
-
|
518
|
-
|
519
|
-
|
517
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 100</span>
|
518
|
+
100: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unprotect</span>(<span class="ruby-identifier">name</span>)
|
519
|
+
101: <span class="ruby-ivar">@_protected</span>.<span class="ruby-identifier">reject!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span> }
|
520
|
+
102: <span class="ruby-keyword kw">end</span>
|
520
521
|
</pre>
|
521
522
|
</div>
|
522
523
|
</div>
|
@@ -536,14 +537,14 @@ Removes the protection of a parameter.
|
|
536
537
|
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
537
538
|
<div class="method-source-code" id="M000015-source">
|
538
539
|
<pre>
|
539
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
540
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 104</span>
|
541
|
+
104: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unprotect_all!</span>
|
542
|
+
105: <span class="ruby-ivar">@_protected</span>.<span class="ruby-identifier">clear</span>
|
543
|
+
106: <span class="ruby-ivar">@_store</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
|
544
|
+
107: <span class="ruby-identifier">val</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">k</span>)
|
545
|
+
108: <span class="ruby-identifier">val</span>.<span class="ruby-identifier">unprotect_all!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Configatron</span><span class="ruby-operator">::</span><span class="ruby-constant">Store</span>
|
546
|
+
109: <span class="ruby-keyword kw">end</span>
|
547
|
+
110: <span class="ruby-keyword kw">end</span>
|
547
548
|
</pre>
|
548
549
|
</div>
|
549
550
|
</div>
|
data/doc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Sun, 28 Sep 2008 21:23:52 -0400
|
data/doc/files/README.html
CHANGED
data/lib/configatron/store.rb
CHANGED
@@ -6,6 +6,7 @@ class Configatron
|
|
6
6
|
@_store = {}
|
7
7
|
configure_from_hash(options)
|
8
8
|
@_protected = []
|
9
|
+
# self.methods.each { |m| puts "m: #{m}"; configatron.protect(m.to_sym) }
|
9
10
|
end
|
10
11
|
|
11
12
|
# Returns a Hash representing the configurations
|
@@ -64,7 +65,7 @@ class Configatron
|
|
64
65
|
def method_missing(sym, *args) # :nodoc:
|
65
66
|
if sym.to_s.match(/(.+)=$/)
|
66
67
|
name = sym.to_s.gsub("=", '').to_sym
|
67
|
-
raise Configatron::ProtectedParameter.new(name) if @_protected.include?(name)
|
68
|
+
raise Configatron::ProtectedParameter.new(name) if @_protected.include?(name) || self.methods.include?(name.to_s)
|
68
69
|
@_store[name] = parse_options(*args)
|
69
70
|
elsif @_store.has_key?(sym)
|
70
71
|
return @_store[sym]
|
@@ -15,6 +15,11 @@ describe "configatron" do
|
|
15
15
|
configatron.one.should == 1
|
16
16
|
end
|
17
17
|
|
18
|
+
it 'should protect basic methods' do
|
19
|
+
lambda{configatron.object_id = 123456}.should raise_error(Configatron::ProtectedParameter)
|
20
|
+
lambda{configatron.foo.object_id = 123456}.should raise_error(Configatron::ProtectedParameter)
|
21
|
+
end
|
22
|
+
|
18
23
|
it 'should work with nested parameters' do
|
19
24
|
configatron.one = 1
|
20
25
|
configatron.letters.a = 'A'
|
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.2
|
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-09-
|
12
|
+
date: 2008-09-28 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|