configatron 2.1.6 → 2.2.0
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.
- data/doc/classes/Configatron/LockedNamespace.html +146 -0
- data/doc/classes/Configatron/Store.html +167 -154
- data/doc/classes/Configatron.html +45 -32
- data/doc/created.rid +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/configatron.rb +2 -0
- data/lib/configatron/store.rb +9 -4
- data/spec/spec_helper.rb +0 -1
- metadata +3 -2
@@ -0,0 +1,146 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Configatron::LockedNamespace</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Configatron::LockedNamespace</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/configatron/errors_rb.html">
|
59
|
+
lib/configatron/errors.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
StandardError
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000024">new</a>
|
90
|
+
</div>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
<!-- if includes -->
|
97
|
+
|
98
|
+
<div id="section">
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<!-- if method_list -->
|
108
|
+
<div id="methods">
|
109
|
+
<h3 class="section-bar">Public Class methods</h3>
|
110
|
+
|
111
|
+
<div id="method-M000024" class="method-detail">
|
112
|
+
<a name="M000024"></a>
|
113
|
+
|
114
|
+
<div class="method-heading">
|
115
|
+
<a href="#M000024" class="method-signature">
|
116
|
+
<span class="method-name">new</span><span class="method-args">(name)</span>
|
117
|
+
</a>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div class="method-description">
|
121
|
+
<p><a class="source-toggle" href="#"
|
122
|
+
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
123
|
+
<div class="method-source-code" id="M000024-source">
|
124
|
+
<pre>
|
125
|
+
<span class="ruby-comment cmt"># File lib/configatron/errors.rb, line 9</span>
|
126
|
+
9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>)
|
127
|
+
10: <span class="ruby-keyword kw">super</span>(<span class="ruby-node">"Cannot add new parameters to locked namespace: #{name.inspect}"</span>)
|
128
|
+
11: <span class="ruby-keyword kw">end</span>
|
129
|
+
</pre>
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
|
135
|
+
</div>
|
136
|
+
|
137
|
+
|
138
|
+
</div>
|
139
|
+
|
140
|
+
|
141
|
+
<div id="validator-badges">
|
142
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
143
|
+
</div>
|
144
|
+
|
145
|
+
</body>
|
146
|
+
</html>
|
@@ -116,6 +116,19 @@
|
|
116
116
|
|
117
117
|
|
118
118
|
|
119
|
+
<div id="aliases-list">
|
120
|
+
<h3 class="section-bar">External Aliases</h3>
|
121
|
+
|
122
|
+
<div class="name-list">
|
123
|
+
<table summary="aliases">
|
124
|
+
<tr class="top-aligned-row context-row">
|
125
|
+
<td class="context-item-name">send</td>
|
126
|
+
<td>-></td>
|
127
|
+
<td class="context-item-value">send!</td>
|
128
|
+
</tr>
|
129
|
+
</table>
|
130
|
+
</div>
|
131
|
+
</div>
|
119
132
|
|
120
133
|
|
121
134
|
|
@@ -142,14 +155,14 @@ Takes an optional Hash of parameters
|
|
142
155
|
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
143
156
|
<div class="method-source-code" id="M000006-source">
|
144
157
|
<pre>
|
145
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
158
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 6</span>
|
159
|
+
6: <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>)
|
160
|
+
7: <span class="ruby-ivar">@_name</span> = <span class="ruby-identifier">name</span>
|
161
|
+
8: <span class="ruby-ivar">@_parent</span> = <span class="ruby-identifier">parent</span>
|
162
|
+
9: <span class="ruby-ivar">@_store</span> = {}
|
163
|
+
10: <span class="ruby-identifier">configure_from_hash</span>(<span class="ruby-identifier">options</span>)
|
164
|
+
11: <span class="ruby-ivar">@_protected</span> = []
|
165
|
+
12: <span class="ruby-keyword kw">end</span>
|
153
166
|
</pre>
|
154
167
|
</div>
|
155
168
|
</div>
|
@@ -174,10 +187,10 @@ Allows for the configuration of the system via a Hash
|
|
174
187
|
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
175
188
|
<div class="method-source-code" id="M000009-source">
|
176
189
|
<pre>
|
177
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
178
|
-
|
179
|
-
|
180
|
-
|
190
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 51</span>
|
191
|
+
51: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configure_from_hash</span>(<span class="ruby-identifier">options</span>)
|
192
|
+
52: <span class="ruby-identifier">parse_options</span>(<span class="ruby-identifier">options</span>)
|
193
|
+
53: <span class="ruby-keyword kw">end</span>
|
181
194
|
</pre>
|
182
195
|
</div>
|
183
196
|
</div>
|
@@ -202,16 +215,16 @@ indicates a specific hash that should be loaded from the file.
|
|
202
215
|
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
203
216
|
<div class="method-source-code" id="M000010-source">
|
204
217
|
<pre>
|
205
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
218
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 59</span>
|
219
|
+
59: <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> = {})
|
220
|
+
60: <span class="ruby-keyword kw">begin</span>
|
221
|
+
61: <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>))
|
222
|
+
62: <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>
|
223
|
+
63: <span class="ruby-identifier">configure_from_hash</span>(<span class="ruby-identifier">yml</span>)
|
224
|
+
64: <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>
|
225
|
+
65: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
|
226
|
+
66: <span class="ruby-keyword kw">end</span>
|
227
|
+
67: <span class="ruby-keyword kw">end</span>
|
215
228
|
</pre>
|
216
229
|
</div>
|
217
230
|
</div>
|
@@ -272,38 +285,38 @@ href="http://simplypowerful.1984.cz/goodlibs/1.2006.05.23">simplypowerful.1984.c
|
|
272
285
|
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
273
286
|
<div class="method-source-code" id="M000021-source">
|
274
287
|
<pre>
|
275
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
288
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 192</span>
|
289
|
+
192: <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>={} )
|
290
|
+
193: <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> )
|
291
|
+
194: <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>]
|
292
|
+
195: <span class="ruby-keyword kw">else</span>
|
293
|
+
196: <span class="ruby-keyword kw">begin</span>
|
294
|
+
197: <span class="ruby-identifier">cl</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">clone</span>
|
295
|
+
198: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
|
296
|
+
199: <span class="ruby-comment cmt"># unclonnable (TrueClass, Fixnum, ...)</span>
|
297
|
+
200: <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>
|
298
|
+
201: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">obj</span>
|
299
|
+
202: <span class="ruby-keyword kw">else</span>
|
300
|
+
203: <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>
|
301
|
+
204: <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>
|
302
|
+
205: <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> )
|
303
|
+
206: <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>
|
304
|
+
207: <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> )
|
305
|
+
208: }
|
306
|
+
209: <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> )
|
307
|
+
210: <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>
|
308
|
+
211: <span class="ruby-identifier">deep_clone</span>( <span class="ruby-identifier">v</span>, <span class="ruby-identifier">cloned</span> )
|
309
|
+
212: }
|
310
|
+
213: <span class="ruby-keyword kw">end</span>
|
311
|
+
214: <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>
|
312
|
+
215: <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>.<span class="ruby-identifier">to_s</span> )
|
313
|
+
216: <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> )
|
314
|
+
217: <span class="ruby-identifier">cl</span>.<span class="ruby-identifier">instance_eval</span>( <span class="ruby-node">"#{var} = v_cl"</span> )
|
315
|
+
218: <span class="ruby-keyword kw">end</span>
|
316
|
+
219: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">cl</span>
|
317
|
+
220: <span class="ruby-keyword kw">end</span>
|
318
|
+
221: <span class="ruby-keyword kw">end</span>
|
319
|
+
222: <span class="ruby-keyword kw">end</span>
|
307
320
|
</pre>
|
308
321
|
</div>
|
309
322
|
</div>
|
@@ -323,37 +336,37 @@ href="http://simplypowerful.1984.cz/goodlibs/1.2006.05.23">simplypowerful.1984.c
|
|
323
336
|
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
324
337
|
<div class="method-source-code" id="M000008-source">
|
325
338
|
<pre>
|
326
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
339
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 19</span>
|
340
|
+
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
|
341
|
+
20: <span class="ruby-identifier">path</span> = [<span class="ruby-ivar">@_name</span>]
|
342
|
+
21: <span class="ruby-identifier">parent</span> = <span class="ruby-ivar">@_parent</span>
|
343
|
+
22: <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">nil?</span>
|
344
|
+
23: <span class="ruby-identifier">path</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-value str">'@_name'</span>)
|
345
|
+
24: <span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-value str">'@_parent'</span>)
|
346
|
+
25: <span class="ruby-keyword kw">end</span>
|
347
|
+
26: <span class="ruby-identifier">path</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">'configatron'</span>
|
348
|
+
27: <span class="ruby-identifier">path</span>.<span class="ruby-identifier">compact!</span>
|
349
|
+
28: <span class="ruby-identifier">path</span>.<span class="ruby-identifier">reverse!</span>
|
350
|
+
29: <span class="ruby-identifier">f_out</span> = []
|
351
|
+
30: <span class="ruby-ivar">@_store</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-identifier">v</span><span class="ruby-operator">|</span>
|
352
|
+
31: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Configatron</span><span class="ruby-operator">::</span><span class="ruby-constant">Store</span>)
|
353
|
+
32: <span class="ruby-identifier">v</span>.<span class="ruby-identifier">inspect</span>.<span class="ruby-identifier">each_line</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
354
|
+
33: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/\n/</span>)
|
355
|
+
34: <span class="ruby-identifier">line</span>.<span class="ruby-identifier">each_line</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span>
|
356
|
+
35: <span class="ruby-identifier">l</span>.<span class="ruby-identifier">strip!</span>
|
357
|
+
36: <span class="ruby-identifier">f_out</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">l</span>
|
358
|
+
37: <span class="ruby-keyword kw">end</span>
|
359
|
+
38: <span class="ruby-keyword kw">else</span>
|
360
|
+
39: <span class="ruby-identifier">line</span>.<span class="ruby-identifier">strip!</span>
|
361
|
+
40: <span class="ruby-identifier">f_out</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">line</span>
|
362
|
+
41: <span class="ruby-keyword kw">end</span>
|
363
|
+
42: <span class="ruby-keyword kw">end</span>
|
364
|
+
43: <span class="ruby-keyword kw">else</span>
|
365
|
+
44: <span class="ruby-identifier">f_out</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{path.join('.')}.#{k} = #{v.inspect}"</span>
|
366
|
+
45: <span class="ruby-keyword kw">end</span>
|
367
|
+
46: <span class="ruby-keyword kw">end</span>
|
368
|
+
47: <span class="ruby-identifier">f_out</span>.<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>)
|
369
|
+
48: <span class="ruby-keyword kw">end</span>
|
357
370
|
</pre>
|
358
371
|
</div>
|
359
372
|
</div>
|
@@ -378,12 +391,12 @@ recursively to any namespaces below it.
|
|
378
391
|
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
379
392
|
<div class="method-source-code" id="M000019-source">
|
380
393
|
<pre>
|
381
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
394
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 144</span>
|
395
|
+
144: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lock</span>(<span class="ruby-identifier">name</span>)
|
396
|
+
145: <span class="ruby-identifier">namespace</span> = <span class="ruby-ivar">@_store</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>]
|
397
|
+
146: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"Namespace #{name.inspect} does not exist"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">namespace</span>.<span class="ruby-identifier">nil?</span>
|
398
|
+
147: <span class="ruby-identifier">namespace</span>.<span class="ruby-identifier">lock!</span>
|
399
|
+
148: <span class="ruby-keyword kw">end</span>
|
387
400
|
</pre>
|
388
401
|
</div>
|
389
402
|
</div>
|
@@ -406,10 +419,10 @@ Returns true if there are no configuration parameters
|
|
406
419
|
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
407
420
|
<div class="method-source-code" id="M000011-source">
|
408
421
|
<pre>
|
409
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
410
|
-
|
411
|
-
|
412
|
-
|
422
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 70</span>
|
423
|
+
70: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nil?</span>
|
424
|
+
71: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@_store</span>.<span class="ruby-identifier">empty?</span>
|
425
|
+
72: <span class="ruby-keyword kw">end</span>
|
413
426
|
</pre>
|
414
427
|
</div>
|
415
428
|
</div>
|
@@ -434,10 +447,10 @@ well.
|
|
434
447
|
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
435
448
|
<div class="method-source-code" id="M000015-source">
|
436
449
|
<pre>
|
437
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
438
|
-
|
439
|
-
|
440
|
-
|
450
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 115</span>
|
451
|
+
115: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">protect</span>(<span class="ruby-identifier">name</span>)
|
452
|
+
116: <span class="ruby-ivar">@_protected</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>
|
453
|
+
117: <span class="ruby-keyword kw">end</span>
|
441
454
|
</pre>
|
442
455
|
</div>
|
443
456
|
</div>
|
@@ -460,15 +473,15 @@ Prevents all parameters from being reassigned.
|
|
460
473
|
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
461
474
|
<div class="method-source-code" id="M000016-source">
|
462
475
|
<pre>
|
463
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
476
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 120</span>
|
477
|
+
120: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">protect_all!</span>
|
478
|
+
121: <span class="ruby-ivar">@_protected</span>.<span class="ruby-identifier">clear</span>
|
479
|
+
122: <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>
|
480
|
+
123: <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>)
|
481
|
+
124: <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>
|
482
|
+
125: <span class="ruby-ivar">@_protected</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">k</span>
|
483
|
+
126: <span class="ruby-keyword kw">end</span>
|
484
|
+
127: <span class="ruby-keyword kw">end</span>
|
472
485
|
</pre>
|
473
486
|
</div>
|
474
487
|
</div>
|
@@ -492,10 +505,10 @@ href="Store.html#M000013">remove</a> all below it.
|
|
492
505
|
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
493
506
|
<div class="method-source-code" id="M000013-source">
|
494
507
|
<pre>
|
495
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
496
|
-
|
497
|
-
|
498
|
-
|
508
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 82</span>
|
509
|
+
82: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove</span>(<span class="ruby-identifier">name</span>)
|
510
|
+
83: <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>)
|
511
|
+
84: <span class="ruby-keyword kw">end</span>
|
499
512
|
</pre>
|
500
513
|
</div>
|
501
514
|
</div>
|
@@ -519,10 +532,10 @@ will return the default_value specified.
|
|
519
532
|
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
520
533
|
<div class="method-source-code" id="M000012-source">
|
521
534
|
<pre>
|
522
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
523
|
-
|
524
|
-
|
525
|
-
|
535
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 76</span>
|
536
|
+
76: <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>)
|
537
|
+
77: <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>
|
538
|
+
78: <span class="ruby-keyword kw">end</span>
|
526
539
|
</pre>
|
527
540
|
</div>
|
528
541
|
</div>
|
@@ -546,12 +559,12 @@ it won‘t set the value.
|
|
546
559
|
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
547
560
|
<div class="method-source-code" id="M000014-source">
|
548
561
|
<pre>
|
549
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
562
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 88</span>
|
563
|
+
88: <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>)
|
564
|
+
89: <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>]
|
565
|
+
90: <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>)
|
566
|
+
91: <span class="ruby-keyword kw">end</span>
|
567
|
+
92: <span class="ruby-keyword kw">end</span>
|
555
568
|
</pre>
|
556
569
|
</div>
|
557
570
|
</div>
|
@@ -574,10 +587,10 @@ Returns a Hash representing the configurations
|
|
574
587
|
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
575
588
|
<div class="method-source-code" id="M000007-source">
|
576
589
|
<pre>
|
577
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
578
|
-
|
579
|
-
|
580
|
-
|
590
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 15</span>
|
591
|
+
15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_hash</span>
|
592
|
+
16: <span class="ruby-ivar">@_store</span>
|
593
|
+
17: <span class="ruby-keyword kw">end</span>
|
581
594
|
</pre>
|
582
595
|
</div>
|
583
596
|
</div>
|
@@ -597,12 +610,12 @@ Returns a Hash representing the configurations
|
|
597
610
|
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
598
611
|
<div class="method-source-code" id="M000020-source">
|
599
612
|
<pre>
|
600
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
613
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 150</span>
|
614
|
+
150: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unlock</span>(<span class="ruby-identifier">name</span>)
|
615
|
+
151: <span class="ruby-identifier">namespace</span> = <span class="ruby-ivar">@_store</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>]
|
616
|
+
152: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"Namespace #{name.inspect} does not exist"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">namespace</span>.<span class="ruby-identifier">nil?</span>
|
617
|
+
153: <span class="ruby-identifier">namespace</span>.<span class="ruby-identifier">unlock!</span>
|
618
|
+
154: <span class="ruby-keyword kw">end</span>
|
606
619
|
</pre>
|
607
620
|
</div>
|
608
621
|
</div>
|
@@ -625,10 +638,10 @@ Removes the protection of a parameter.
|
|
625
638
|
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
626
639
|
<div class="method-source-code" id="M000017-source">
|
627
640
|
<pre>
|
628
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
629
|
-
|
630
|
-
|
631
|
-
|
641
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 130</span>
|
642
|
+
130: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unprotect</span>(<span class="ruby-identifier">name</span>)
|
643
|
+
131: <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> }
|
644
|
+
132: <span class="ruby-keyword kw">end</span>
|
632
645
|
</pre>
|
633
646
|
</div>
|
634
647
|
</div>
|
@@ -648,14 +661,14 @@ Removes the protection of a parameter.
|
|
648
661
|
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
649
662
|
<div class="method-source-code" id="M000018-source">
|
650
663
|
<pre>
|
651
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
664
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 134</span>
|
665
|
+
134: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unprotect_all!</span>
|
666
|
+
135: <span class="ruby-ivar">@_protected</span>.<span class="ruby-identifier">clear</span>
|
667
|
+
136: <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>
|
668
|
+
137: <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>)
|
669
|
+
138: <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>
|
670
|
+
139: <span class="ruby-keyword kw">end</span>
|
671
|
+
140: <span class="ruby-keyword kw">end</span>
|
659
672
|
</pre>
|
660
673
|
</div>
|
661
674
|
</div>
|
@@ -677,11 +690,11 @@ Removes the protection of a parameter.
|
|
677
690
|
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
678
691
|
<div class="method-source-code" id="M000022-source">
|
679
692
|
<pre>
|
680
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
693
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 225</span>
|
694
|
+
225: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lock!</span>
|
695
|
+
226: <span class="ruby-ivar">@_locked</span> = <span class="ruby-keyword kw">true</span>
|
696
|
+
227: <span class="ruby-ivar">@_store</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">store</span><span class="ruby-operator">|</span> <span class="ruby-identifier">store</span>.<span class="ruby-identifier">lock!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">store</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Configatron</span><span class="ruby-operator">::</span><span class="ruby-constant">Store</span>) }
|
697
|
+
228: <span class="ruby-keyword kw">end</span>
|
685
698
|
</pre>
|
686
699
|
</div>
|
687
700
|
</div>
|
@@ -701,11 +714,11 @@ Removes the protection of a parameter.
|
|
701
714
|
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
702
715
|
<div class="method-source-code" id="M000023-source">
|
703
716
|
<pre>
|
704
|
-
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
717
|
+
<span class="ruby-comment cmt"># File lib/configatron/store.rb, line 230</span>
|
718
|
+
230: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unlock!</span>
|
719
|
+
231: <span class="ruby-ivar">@_locked</span> = <span class="ruby-keyword kw">false</span>
|
720
|
+
232: <span class="ruby-ivar">@_store</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">store</span><span class="ruby-operator">|</span> <span class="ruby-identifier">store</span>.<span class="ruby-identifier">unlock!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">store</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Configatron</span><span class="ruby-operator">::</span><span class="ruby-constant">Store</span>) }
|
721
|
+
233: <span class="ruby-keyword kw">end</span>
|
709
722
|
</pre>
|
710
723
|
</div>
|
711
724
|
</div>
|
@@ -126,6 +126,19 @@ Class <a href="Configatron/Store.html" class="link">Configatron::Store</a><br />
|
|
126
126
|
</div>
|
127
127
|
|
128
128
|
|
129
|
+
<div id="aliases-list">
|
130
|
+
<h3 class="section-bar">External Aliases</h3>
|
131
|
+
|
132
|
+
<div class="name-list">
|
133
|
+
<table summary="aliases">
|
134
|
+
<tr class="top-aligned-row context-row">
|
135
|
+
<td class="context-item-name">send</td>
|
136
|
+
<td>-></td>
|
137
|
+
<td class="context-item-value">send!</td>
|
138
|
+
</tr>
|
139
|
+
</table>
|
140
|
+
</div>
|
141
|
+
</div>
|
129
142
|
|
130
143
|
|
131
144
|
|
@@ -153,10 +166,10 @@ href="Configatron/Store.html">Configatron::Store</a>
|
|
153
166
|
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
154
167
|
<div class="method-source-code" id="M000001-source">
|
155
168
|
<pre>
|
156
|
-
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line
|
157
|
-
|
158
|
-
|
159
|
-
|
169
|
+
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 14</span>
|
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>)
|
172
|
+
16: <span class="ruby-keyword kw">end</span>
|
160
173
|
</pre>
|
161
174
|
</div>
|
162
175
|
</div>
|
@@ -179,10 +192,10 @@ Removes ALL configuration parameters
|
|
179
192
|
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
180
193
|
<div class="method-source-code" id="M000002-source">
|
181
194
|
<pre>
|
182
|
-
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line
|
183
|
-
|
184
|
-
|
185
|
-
|
195
|
+
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 19</span>
|
196
|
+
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset!</span>
|
197
|
+
20: <span class="ruby-ivar">@_store</span> = {<span class="ruby-identifier">:default</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Configatron</span><span class="ruby-operator">::</span><span class="ruby-constant">Store</span>.<span class="ruby-identifier">new</span>}
|
198
|
+
21: <span class="ruby-keyword kw">end</span>
|
186
199
|
</pre>
|
187
200
|
</div>
|
188
201
|
</div>
|
@@ -208,17 +221,17 @@ original settings are reinstated.
|
|
208
221
|
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
209
222
|
<div class="method-source-code" id="M000003-source">
|
210
223
|
<pre>
|
211
|
-
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
224
|
+
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 27</span>
|
225
|
+
27: <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>)
|
226
|
+
28: <span class="ruby-keyword kw">begin</span>
|
227
|
+
29: <span class="ruby-identifier">temp_start</span>(<span class="ruby-identifier">options</span>)
|
228
|
+
30: <span class="ruby-keyword kw">yield</span>
|
229
|
+
31: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
230
|
+
32: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
231
|
+
33: <span class="ruby-keyword kw">ensure</span>
|
232
|
+
34: <span class="ruby-identifier">temp_end</span>
|
233
|
+
35: <span class="ruby-keyword kw">end</span>
|
234
|
+
36: <span class="ruby-keyword kw">end</span>
|
222
235
|
</pre>
|
223
236
|
</div>
|
224
237
|
</div>
|
@@ -238,11 +251,11 @@ original settings are reinstated.
|
|
238
251
|
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
239
252
|
<div class="method-source-code" id="M000005-source">
|
240
253
|
<pre>
|
241
|
-
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
254
|
+
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 46</span>
|
255
|
+
46: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">temp_end</span>
|
256
|
+
47: <span class="ruby-ivar">@_store</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-ivar">@_namespace</span>)
|
257
|
+
48: <span class="ruby-ivar">@_namespace</span> = <span class="ruby-identifier">:default</span>
|
258
|
+
49: <span class="ruby-keyword kw">end</span>
|
246
259
|
</pre>
|
247
260
|
</div>
|
248
261
|
</div>
|
@@ -262,14 +275,14 @@ original settings are reinstated.
|
|
262
275
|
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
263
276
|
<div class="method-source-code" id="M000004-source">
|
264
277
|
<pre>
|
265
|
-
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
278
|
+
<span class="ruby-comment cmt"># File lib/configatron/configatron.rb, line 38</span>
|
279
|
+
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-ivar">@_namespace</span> = <span class="ruby-identifier">rand</span>
|
281
|
+
40: <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>
|
282
|
+
41: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>
|
283
|
+
42: <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
|
+
43: <span class="ruby-keyword kw">end</span>
|
285
|
+
44: <span class="ruby-keyword kw">end</span>
|
273
286
|
</pre>
|
274
287
|
</div>
|
275
288
|
</div>
|
data/doc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Thu, 01 Jan 2009 11:18:34 -0500
|
data/lib/configatron/store.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
class Configatron
|
2
2
|
class Store
|
3
|
+
alias_method :send!, :send
|
3
4
|
|
4
5
|
# Takes an optional Hash of parameters
|
5
6
|
def initialize(options = {}, name = nil, parent = nil)
|
@@ -28,9 +29,9 @@ class Configatron
|
|
28
29
|
f_out = []
|
29
30
|
@_store.each do |k, v|
|
30
31
|
if v.is_a?(Configatron::Store)
|
31
|
-
v.inspect.
|
32
|
+
v.inspect.each_line do |line|
|
32
33
|
if line.match(/\n/)
|
33
|
-
line.
|
34
|
+
line.each_line do |l|
|
34
35
|
l.strip!
|
35
36
|
f_out << l
|
36
37
|
end
|
@@ -93,7 +94,7 @@ class Configatron
|
|
93
94
|
def method_missing(sym, *args) # :nodoc:
|
94
95
|
if sym.to_s.match(/(.+)=$/)
|
95
96
|
name = sym.to_s.gsub("=", '').to_sym
|
96
|
-
raise Configatron::ProtectedParameter.new(name) if @_protected.include?(name) ||
|
97
|
+
raise Configatron::ProtectedParameter.new(name) if @_protected.include?(name) || methods_include?(name)
|
97
98
|
raise Configatron::LockedNamespace.new(@_name) if @_locked && !@_store.has_key?(name)
|
98
99
|
@_store[name] = parse_options(*args)
|
99
100
|
elsif @_store.has_key?(sym)
|
@@ -211,7 +212,7 @@ class Configatron
|
|
211
212
|
}
|
212
213
|
end
|
213
214
|
cl.instance_variables.each do |var|
|
214
|
-
v = cl.instance_eval( var )
|
215
|
+
v = cl.instance_eval( var.to_s )
|
215
216
|
v_cl = deep_clone( v, cloned )
|
216
217
|
cl.instance_eval( "#{var} = v_cl" )
|
217
218
|
end
|
@@ -232,6 +233,10 @@ class Configatron
|
|
232
233
|
end
|
233
234
|
|
234
235
|
private
|
236
|
+
def methods_include?(name)
|
237
|
+
self.methods.include?(RUBY_VERSION > '1.9.0' ? name.to_sym : name.to_s)
|
238
|
+
end
|
239
|
+
|
235
240
|
def parse_options(options)
|
236
241
|
if options.is_a?(Hash)
|
237
242
|
options.each do |k,v|
|
data/spec/spec_helper.rb
CHANGED
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.
|
4
|
+
version: 2.2.0
|
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:
|
12
|
+
date: 2009-01-01 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -28,6 +28,7 @@ files:
|
|
28
28
|
- lib/configatron/store.rb
|
29
29
|
- lib/configatron.rb
|
30
30
|
- README
|
31
|
+
- doc/classes/Configatron/LockedNamespace.html
|
31
32
|
- doc/classes/Configatron/ProtectedParameter.html
|
32
33
|
- doc/classes/Configatron/Store.html
|
33
34
|
- doc/classes/Configatron.html
|