configatron 1.0.0 → 1.0.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.
- data/README +3 -3
- data/doc/classes/Configatron/Configuration.html +342 -0
- data/doc/classes/Configatron/Helpers.html +174 -0
- data/doc/classes/Configatron/Store.html +281 -0
- data/doc/classes/Kernel.html +151 -0
- data/doc/created.rid +1 -0
- data/doc/files/README.html +230 -0
- data/doc/files/lib/configatron_rb.html +108 -0
- data/doc/files/lib/configuration_rb.html +101 -0
- data/doc/files/lib/helpers_rb.html +101 -0
- data/doc/files/lib/kernel_rb.html +101 -0
- data/doc/files/lib/store_rb.html +101 -0
- data/doc/fr_class_index.html +30 -0
- data/doc/fr_file_index.html +32 -0
- data/doc/fr_method_index.html +39 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/configuration.rb +1 -1
- data/lib/helpers.rb +5 -1
- data/lib/store.rb +1 -0
- metadata +17 -1
data/README
CHANGED
@@ -37,13 +37,13 @@ The question that should be on your lips is what I need to have namespaced confi
|
|
37
37
|
|
38
38
|
configatron do |config|
|
39
39
|
config.website_url = "http://www.mackframework.com"
|
40
|
-
config.email do |email|
|
41
|
-
email.pop do |pop|
|
40
|
+
config.namespace(:email) do |email|
|
41
|
+
email.namespace(:pop) do |pop|
|
42
42
|
pop.address = "pop.example.com"
|
43
43
|
pop.port = "110"
|
44
44
|
# etc ...
|
45
45
|
end
|
46
|
-
email.smtp do |smtp|
|
46
|
+
email.namespace(:smtp) do |smtp|
|
47
47
|
smtp.address = "smtp.example.com"
|
48
48
|
smtp.port = "25"
|
49
49
|
# etc ...
|
@@ -0,0 +1,342 @@
|
|
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::Configuration</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::Configuration</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/configuration_rb.html">
|
59
|
+
lib/configuration.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
|
+
Object
|
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
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
The central class for managing the configurations.
|
84
|
+
</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="method-list">
|
92
|
+
<h3 class="section-bar">Methods</h3>
|
93
|
+
|
94
|
+
<div class="name-list">
|
95
|
+
<a href="#M000007">configure</a>
|
96
|
+
<a href="#M000008">configure_from_hash</a>
|
97
|
+
<a href="#M000009">reload</a>
|
98
|
+
<a href="#M000011">reset</a>
|
99
|
+
<a href="#M000010">reset!</a>
|
100
|
+
<a href="#M000012">revert</a>
|
101
|
+
</div>
|
102
|
+
</div>
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
|
107
|
+
<!-- if includes -->
|
108
|
+
<div id="includes">
|
109
|
+
<h3 class="section-bar">Included Modules</h3>
|
110
|
+
|
111
|
+
<div id="includes-list">
|
112
|
+
<span class="include-name">Singleton</span>
|
113
|
+
<span class="include-name"><a href="Helpers.html">Configatron::Helpers</a></span>
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
<div id="section">
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
<div id="attribute-list">
|
124
|
+
<h3 class="section-bar">Attributes</h3>
|
125
|
+
|
126
|
+
<div class="name-list">
|
127
|
+
<table>
|
128
|
+
<tr class="top-aligned-row context-row">
|
129
|
+
<td class="context-item-name">nil_for_missing</td>
|
130
|
+
<td class="context-item-value"> [RW] </td>
|
131
|
+
<td class="context-item-desc">
|
132
|
+
If nil_for_missing is set to true nil will be returned if the configuration
|
133
|
+
parameter doesn‘t exist. If set to false, default, then a
|
134
|
+
NoMethodError exception will be raised.
|
135
|
+
|
136
|
+
</td>
|
137
|
+
</tr>
|
138
|
+
</table>
|
139
|
+
</div>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<!-- if method_list -->
|
145
|
+
<div id="methods">
|
146
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
147
|
+
|
148
|
+
<div id="method-M000007" class="method-detail">
|
149
|
+
<a name="M000007"></a>
|
150
|
+
|
151
|
+
<div class="method-heading">
|
152
|
+
<a href="#M000007" class="method-signature">
|
153
|
+
<span class="method-name">configure</span><span class="method-args">() {|storage| ...}</span>
|
154
|
+
</a>
|
155
|
+
</div>
|
156
|
+
|
157
|
+
<div class="method-description">
|
158
|
+
<p>
|
159
|
+
Yields a new <a href="Store.html">Configatron::Store</a> class.
|
160
|
+
</p>
|
161
|
+
<p><a class="source-toggle" href="#"
|
162
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
163
|
+
<div class="method-source-code" id="M000007-source">
|
164
|
+
<pre>
|
165
|
+
<span class="ruby-comment cmt"># File lib/configuration.rb, line 18</span>
|
166
|
+
18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configure</span>
|
167
|
+
19: <span class="ruby-identifier">storage</span> = <span class="ruby-constant">Configatron</span><span class="ruby-operator">::</span><span class="ruby-constant">Store</span>.<span class="ruby-identifier">new</span>
|
168
|
+
20: <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">storage</span>
|
169
|
+
21: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">storage</span>.<span class="ruby-identifier">parameters</span>.<span class="ruby-identifier">empty?</span>
|
170
|
+
22: <span class="ruby-ivar">@_storage_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">storage</span>
|
171
|
+
23: <span class="ruby-identifier">load_methods</span>(<span class="ruby-identifier">storage</span>)
|
172
|
+
24: <span class="ruby-keyword kw">end</span>
|
173
|
+
25: <span class="ruby-keyword kw">end</span>
|
174
|
+
</pre>
|
175
|
+
</div>
|
176
|
+
</div>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
<div id="method-M000008" class="method-detail">
|
180
|
+
<a name="M000008"></a>
|
181
|
+
|
182
|
+
<div class="method-heading">
|
183
|
+
<a href="#M000008" class="method-signature">
|
184
|
+
<span class="method-name">configure_from_hash</span><span class="method-args">(parameters)</span>
|
185
|
+
</a>
|
186
|
+
</div>
|
187
|
+
|
188
|
+
<div class="method-description">
|
189
|
+
<p>
|
190
|
+
Used to load configuration settings from a Hash.
|
191
|
+
</p>
|
192
|
+
<p><a class="source-toggle" href="#"
|
193
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
194
|
+
<div class="method-source-code" id="M000008-source">
|
195
|
+
<pre>
|
196
|
+
<span class="ruby-comment cmt"># File lib/configuration.rb, line 28</span>
|
197
|
+
28: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configure_from_hash</span>(<span class="ruby-identifier">parameters</span>)
|
198
|
+
29: <span class="ruby-identifier">storage</span> = <span class="ruby-constant">Configatron</span><span class="ruby-operator">::</span><span class="ruby-constant">Store</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">parameters</span>)
|
199
|
+
30: <span class="ruby-ivar">@_storage_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">storage</span>
|
200
|
+
31: <span class="ruby-identifier">load_methods</span>(<span class="ruby-identifier">storage</span>)
|
201
|
+
32: <span class="ruby-keyword kw">end</span>
|
202
|
+
</pre>
|
203
|
+
</div>
|
204
|
+
</div>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<div id="method-M000009" class="method-detail">
|
208
|
+
<a name="M000009"></a>
|
209
|
+
|
210
|
+
<div class="method-heading">
|
211
|
+
<a href="#M000009" class="method-signature">
|
212
|
+
<span class="method-name">reload</span><span class="method-args">()</span>
|
213
|
+
</a>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
<div class="method-description">
|
217
|
+
<p>
|
218
|
+
Replays the history of configurations.
|
219
|
+
</p>
|
220
|
+
<p><a class="source-toggle" href="#"
|
221
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
222
|
+
<div class="method-source-code" id="M000009-source">
|
223
|
+
<pre>
|
224
|
+
<span class="ruby-comment cmt"># File lib/configuration.rb, line 35</span>
|
225
|
+
35: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload</span>
|
226
|
+
36: <span class="ruby-ivar">@_storage_list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">storage</span><span class="ruby-operator">|</span>
|
227
|
+
37: <span class="ruby-identifier">load_methods</span>(<span class="ruby-identifier">storage</span>)
|
228
|
+
38: <span class="ruby-keyword kw">end</span>
|
229
|
+
39: <span class="ruby-keyword kw">end</span>
|
230
|
+
</pre>
|
231
|
+
</div>
|
232
|
+
</div>
|
233
|
+
</div>
|
234
|
+
|
235
|
+
<div id="method-M000011" class="method-detail">
|
236
|
+
<a name="M000011"></a>
|
237
|
+
|
238
|
+
<div class="method-heading">
|
239
|
+
<a href="#M000011" class="method-signature">
|
240
|
+
<span class="method-name">reset</span><span class="method-args">()</span>
|
241
|
+
</a>
|
242
|
+
</div>
|
243
|
+
|
244
|
+
<div class="method-description">
|
245
|
+
<p>
|
246
|
+
All methods are undefined.
|
247
|
+
</p>
|
248
|
+
<p><a class="source-toggle" href="#"
|
249
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
250
|
+
<div class="method-source-code" id="M000011-source">
|
251
|
+
<pre>
|
252
|
+
<span class="ruby-comment cmt"># File lib/configuration.rb, line 51</span>
|
253
|
+
51: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
|
254
|
+
52: <span class="ruby-ivar">@_storage_list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">storage</span><span class="ruby-operator">|</span>
|
255
|
+
53: <span class="ruby-identifier">storage</span>.<span class="ruby-identifier">parameters</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>
|
256
|
+
54: <span class="ruby-constant">Configatron</span><span class="ruby-operator">::</span><span class="ruby-constant">Configuration</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-keyword kw">do</span>
|
257
|
+
55: <span class="ruby-keyword kw">begin</span>
|
258
|
+
56: <span class="ruby-identifier">undef_method</span>(<span class="ruby-identifier">k</span>)
|
259
|
+
57: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">NameError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
260
|
+
58: <span class="ruby-keyword kw">end</span>
|
261
|
+
59: <span class="ruby-keyword kw">end</span>
|
262
|
+
60: <span class="ruby-keyword kw">end</span>
|
263
|
+
61: <span class="ruby-keyword kw">end</span>
|
264
|
+
62: <span class="ruby-keyword kw">end</span>
|
265
|
+
</pre>
|
266
|
+
</div>
|
267
|
+
</div>
|
268
|
+
</div>
|
269
|
+
|
270
|
+
<div id="method-M000010" class="method-detail">
|
271
|
+
<a name="M000010"></a>
|
272
|
+
|
273
|
+
<div class="method-heading">
|
274
|
+
<a href="#M000010" class="method-signature">
|
275
|
+
<span class="method-name">reset!</span><span class="method-args">()</span>
|
276
|
+
</a>
|
277
|
+
</div>
|
278
|
+
|
279
|
+
<div class="method-description">
|
280
|
+
<p>
|
281
|
+
Does a hard <a href="Configuration.html#M000011">reset</a> of the <a
|
282
|
+
href="Configuration.html">Configatron::Configuration</a> class. All methods
|
283
|
+
are undefined, the list of configuration parameters is emptied, and the
|
284
|
+
nil_for_missing method gets <a href="Configuration.html#M000011">reset</a>
|
285
|
+
to false.
|
286
|
+
</p>
|
287
|
+
<p><a class="source-toggle" href="#"
|
288
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
289
|
+
<div class="method-source-code" id="M000010-source">
|
290
|
+
<pre>
|
291
|
+
<span class="ruby-comment cmt"># File lib/configuration.rb, line 44</span>
|
292
|
+
44: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset!</span>
|
293
|
+
45: <span class="ruby-identifier">reset</span>
|
294
|
+
46: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">nil_for_missing</span> = <span class="ruby-keyword kw">false</span>
|
295
|
+
47: <span class="ruby-ivar">@_storage_list</span> = []
|
296
|
+
48: <span class="ruby-keyword kw">end</span>
|
297
|
+
</pre>
|
298
|
+
</div>
|
299
|
+
</div>
|
300
|
+
</div>
|
301
|
+
|
302
|
+
<div id="method-M000012" class="method-detail">
|
303
|
+
<a name="M000012"></a>
|
304
|
+
|
305
|
+
<div class="method-heading">
|
306
|
+
<a href="#M000012" class="method-signature">
|
307
|
+
<span class="method-name">revert</span><span class="method-args">(step = 1)</span>
|
308
|
+
</a>
|
309
|
+
</div>
|
310
|
+
|
311
|
+
<div class="method-description">
|
312
|
+
<p>
|
313
|
+
Peels back n number of configuration parameters.
|
314
|
+
</p>
|
315
|
+
<p><a class="source-toggle" href="#"
|
316
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
317
|
+
<div class="method-source-code" id="M000012-source">
|
318
|
+
<pre>
|
319
|
+
<span class="ruby-comment cmt"># File lib/configuration.rb, line 65</span>
|
320
|
+
65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">revert</span>(<span class="ruby-identifier">step</span> = <span class="ruby-value">1</span>)
|
321
|
+
66: <span class="ruby-identifier">reset</span>
|
322
|
+
67: <span class="ruby-identifier">step</span>.<span class="ruby-identifier">times</span> {<span class="ruby-ivar">@_storage_list</span>.<span class="ruby-identifier">pop</span>}
|
323
|
+
68: <span class="ruby-identifier">reload</span>
|
324
|
+
69: <span class="ruby-keyword kw">end</span>
|
325
|
+
</pre>
|
326
|
+
</div>
|
327
|
+
</div>
|
328
|
+
</div>
|
329
|
+
|
330
|
+
|
331
|
+
</div>
|
332
|
+
|
333
|
+
|
334
|
+
</div>
|
335
|
+
|
336
|
+
|
337
|
+
<div id="validator-badges">
|
338
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
339
|
+
</div>
|
340
|
+
|
341
|
+
</body>
|
342
|
+
</html>
|
@@ -0,0 +1,174 @@
|
|
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>Module: Configatron::Helpers</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>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Configatron::Helpers</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/helpers_rb.html">
|
59
|
+
lib/helpers.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000001">exists?</a>
|
84
|
+
<a href="#M000002">retrieve</a>
|
85
|
+
</div>
|
86
|
+
</div>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
<!-- if includes -->
|
92
|
+
|
93
|
+
<div id="section">
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
<!-- if method_list -->
|
103
|
+
<div id="methods">
|
104
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
105
|
+
|
106
|
+
<div id="method-M000001" class="method-detail">
|
107
|
+
<a name="M000001"></a>
|
108
|
+
|
109
|
+
<div class="method-heading">
|
110
|
+
<a href="#M000001" class="method-signature">
|
111
|
+
<span class="method-name">exists?</span><span class="method-args">(name)</span>
|
112
|
+
</a>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
<div class="method-description">
|
116
|
+
<p>
|
117
|
+
Checks whether or not configuration parameter exists.
|
118
|
+
</p>
|
119
|
+
<p><a class="source-toggle" href="#"
|
120
|
+
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
121
|
+
<div class="method-source-code" id="M000001-source">
|
122
|
+
<pre>
|
123
|
+
<span class="ruby-comment cmt"># File lib/helpers.rb, line 5</span>
|
124
|
+
5: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">name</span>)
|
125
|
+
6: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">name</span>)
|
126
|
+
7: <span class="ruby-keyword kw">end</span>
|
127
|
+
</pre>
|
128
|
+
</div>
|
129
|
+
</div>
|
130
|
+
</div>
|
131
|
+
|
132
|
+
<div id="method-M000002" class="method-detail">
|
133
|
+
<a name="M000002"></a>
|
134
|
+
|
135
|
+
<div class="method-heading">
|
136
|
+
<a href="#M000002" class="method-signature">
|
137
|
+
<span class="method-name">retrieve</span><span class="method-args">(name, default_value = ArgumentError)</span>
|
138
|
+
</a>
|
139
|
+
</div>
|
140
|
+
|
141
|
+
<div class="method-description">
|
142
|
+
<p>
|
143
|
+
Retrieves the specified config parameter. An optional second parameter can
|
144
|
+
be passed that will be returned if the config parameter doesn‘t
|
145
|
+
exist.
|
146
|
+
</p>
|
147
|
+
<p><a class="source-toggle" href="#"
|
148
|
+
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
149
|
+
<div class="method-source-code" id="M000002-source">
|
150
|
+
<pre>
|
151
|
+
<span class="ruby-comment cmt"># File lib/helpers.rb, line 20</span>
|
152
|
+
20: <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-constant">ArgumentError</span>)
|
153
|
+
21: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">name</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">name</span>)
|
154
|
+
22: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">default_value</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">default_value</span> <span class="ruby-operator">==</span> <span class="ruby-constant">ArgumentError</span>
|
155
|
+
23: <span class="ruby-identifier">handle_missing_parameter</span>(<span class="ruby-identifier">name</span>)
|
156
|
+
24: <span class="ruby-keyword kw">end</span>
|
157
|
+
</pre>
|
158
|
+
</div>
|
159
|
+
</div>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
|
163
|
+
</div>
|
164
|
+
|
165
|
+
|
166
|
+
</div>
|
167
|
+
|
168
|
+
|
169
|
+
<div id="validator-badges">
|
170
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
171
|
+
</div>
|
172
|
+
|
173
|
+
</body>
|
174
|
+
</html>
|