configatron 2.2.0 → 2.2.1
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.
@@ -168,7 +168,7 @@ href="Configatron/Store.html">Configatron::Store</a>
|
|
168
168
|
<pre>
|
169
169
|
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 14</span>
|
170
170
|
14: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
171
|
-
15: <span class="ruby-ivar">@_store</span>[<span class="ruby-ivar">@_namespace</span>].<span class="ruby-identifier">send</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
171
|
+
15: <span class="ruby-ivar">@_store</span>[<span class="ruby-ivar">@_namespace</span>.<span class="ruby-identifier">last</span>].<span class="ruby-identifier">send</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
172
172
|
16: <span class="ruby-keyword kw">end</span>
|
173
173
|
</pre>
|
174
174
|
</div>
|
@@ -251,10 +251,9 @@ original settings are reinstated.
|
|
251
251
|
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
252
252
|
<div class="method-source-code" id="M000005-source">
|
253
253
|
<pre>
|
254
|
-
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line
|
255
|
-
|
256
|
-
|
257
|
-
48: <span class="ruby-ivar">@_namespace</span> = <span class="ruby-identifier">:default</span>
|
254
|
+
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 47</span>
|
255
|
+
47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">temp_end</span>
|
256
|
+
48: <span class="ruby-ivar">@_store</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-ivar">@_namespace</span>.<span class="ruby-identifier">pop</span>)
|
258
257
|
49: <span class="ruby-keyword kw">end</span>
|
259
258
|
</pre>
|
260
259
|
</div>
|
@@ -277,12 +276,13 @@ original settings are reinstated.
|
|
277
276
|
<pre>
|
278
277
|
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 38</span>
|
279
278
|
38: <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>)
|
280
|
-
39: <span class="ruby-
|
281
|
-
40: <span class="ruby-ivar">@_store</span>[<span class="ruby-
|
282
|
-
41: <span class="ruby-
|
283
|
-
42:
|
284
|
-
43:
|
285
|
-
44:
|
279
|
+
39: <span class="ruby-identifier">n_space</span> = <span class="ruby-identifier">rand</span>
|
280
|
+
40: <span class="ruby-ivar">@_store</span>[<span class="ruby-identifier">n_space</span>] = <span class="ruby-ivar">@_store</span>[<span class="ruby-ivar">@_namespace</span>.<span class="ruby-identifier">last</span>].<span class="ruby-identifier">deep_clone</span>
|
281
|
+
41: <span class="ruby-ivar">@_namespace</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">n_space</span>
|
282
|
+
42: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>
|
283
|
+
43: <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>)
|
284
|
+
44: <span class="ruby-keyword kw">end</span>
|
285
|
+
45: <span class="ruby-keyword kw">end</span>
|
286
286
|
</pre>
|
287
287
|
</div>
|
288
288
|
</div>
|
data/doc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Fri, 02 Jan 2009 16:17:04 -0500
|
@@ -6,13 +6,13 @@ class Configatron
|
|
6
6
|
alias_method :send!, :send
|
7
7
|
|
8
8
|
def initialize # :nodoc:
|
9
|
-
@_namespace = :default
|
9
|
+
@_namespace = [:default]
|
10
10
|
reset!
|
11
11
|
end
|
12
12
|
|
13
13
|
# Forwards the method call onto the 'namespaced' Configatron::Store
|
14
14
|
def method_missing(sym, *args)
|
15
|
-
@_store[@_namespace].send(sym, *args)
|
15
|
+
@_store[@_namespace.last].send(sym, *args)
|
16
16
|
end
|
17
17
|
|
18
18
|
# Removes ALL configuration parameters
|
@@ -36,16 +36,16 @@ class Configatron
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def temp_start(options = nil)
|
39
|
-
|
40
|
-
@_store[
|
39
|
+
n_space = rand
|
40
|
+
@_store[n_space] = @_store[@_namespace.last].deep_clone
|
41
|
+
@_namespace << n_space
|
41
42
|
if options
|
42
43
|
self.method_missing(:configure_from_hash, options)
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
46
47
|
def temp_end
|
47
|
-
@_store.delete(@_namespace)
|
48
|
-
@_namespace = :default
|
48
|
+
@_store.delete(@_namespace.pop)
|
49
49
|
end
|
50
50
|
|
51
51
|
undef :inspect # :nodoc:
|
@@ -172,6 +172,31 @@ describe "configatron" do
|
|
172
172
|
configatron.one.should == 1
|
173
173
|
end
|
174
174
|
|
175
|
+
it 'should be able to nest' do
|
176
|
+
configatron.one = 1
|
177
|
+
configatron.letters.a = 'A'
|
178
|
+
configatron.letters.b = 'B'
|
179
|
+
configatron.temp do
|
180
|
+
configatron.letters.b = 'bb'
|
181
|
+
configatron.letters.c = 'c'
|
182
|
+
configatron.one.should == 1
|
183
|
+
configatron.letters.a.should == 'A'
|
184
|
+
configatron.letters.b.should == 'bb'
|
185
|
+
configatron.letters.c.should == 'c'
|
186
|
+
configatron.temp do
|
187
|
+
configatron.letters.b = 'bbb'
|
188
|
+
configatron.one.should == 1
|
189
|
+
configatron.letters.a.should == 'A'
|
190
|
+
configatron.letters.b.should == 'bbb'
|
191
|
+
configatron.letters.c.should == 'c'
|
192
|
+
end
|
193
|
+
end
|
194
|
+
configatron.one.should == 1
|
195
|
+
configatron.letters.a.should == 'A'
|
196
|
+
configatron.letters.b.should == 'B'
|
197
|
+
configatron.letters.c.should be_nil
|
198
|
+
end
|
199
|
+
|
175
200
|
end
|
176
201
|
|
177
202
|
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.2.
|
4
|
+
version: 2.2.1
|
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: 2009-01-
|
12
|
+
date: 2009-01-02 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|