configatron 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,281 @@
|
|
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::Store</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::Store</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/store_rb.html">
|
59
|
+
lib/store.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
|
+
Used to store each of the ‘sets’ of configuration parameters.
|
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="#M000005">exists?</a>
|
96
|
+
<a href="#M000004">method_missing</a>
|
97
|
+
<a href="#M000006">namespace</a>
|
98
|
+
<a href="#M000003">new</a>
|
99
|
+
</div>
|
100
|
+
</div>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
|
105
|
+
<!-- if includes -->
|
106
|
+
<div id="includes">
|
107
|
+
<h3 class="section-bar">Included Modules</h3>
|
108
|
+
|
109
|
+
<div id="includes-list">
|
110
|
+
<span class="include-name"><a href="Helpers.html">Configatron::Helpers</a></span>
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
|
114
|
+
<div id="section">
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
<div id="attribute-list">
|
121
|
+
<h3 class="section-bar">Attributes</h3>
|
122
|
+
|
123
|
+
<div class="name-list">
|
124
|
+
<table>
|
125
|
+
<tr class="top-aligned-row context-row">
|
126
|
+
<td class="context-item-name">parameters</td>
|
127
|
+
<td class="context-item-value"> [R] </td>
|
128
|
+
<td class="context-item-desc">
|
129
|
+
The actual key/pair parameter values.
|
130
|
+
|
131
|
+
</td>
|
132
|
+
</tr>
|
133
|
+
</table>
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
<!-- if method_list -->
|
140
|
+
<div id="methods">
|
141
|
+
<h3 class="section-bar">Public Class methods</h3>
|
142
|
+
|
143
|
+
<div id="method-M000003" class="method-detail">
|
144
|
+
<a name="M000003"></a>
|
145
|
+
|
146
|
+
<div class="method-heading">
|
147
|
+
<a href="#M000003" class="method-signature">
|
148
|
+
<span class="method-name">new</span><span class="method-args">(parameters = {})</span>
|
149
|
+
</a>
|
150
|
+
</div>
|
151
|
+
|
152
|
+
<div class="method-description">
|
153
|
+
<p>
|
154
|
+
Takes an optional Hash to configure parameters.
|
155
|
+
</p>
|
156
|
+
<p><a class="source-toggle" href="#"
|
157
|
+
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
158
|
+
<div class="method-source-code" id="M000003-source">
|
159
|
+
<pre>
|
160
|
+
<span class="ruby-comment cmt"># File lib/store.rb, line 10</span>
|
161
|
+
10: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">parameters</span> = {})
|
162
|
+
11: <span class="ruby-ivar">@parameters</span> = <span class="ruby-identifier">parameters</span>
|
163
|
+
12: <span class="ruby-keyword kw">end</span>
|
164
|
+
</pre>
|
165
|
+
</div>
|
166
|
+
</div>
|
167
|
+
</div>
|
168
|
+
|
169
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
170
|
+
|
171
|
+
<div id="method-M000005" class="method-detail">
|
172
|
+
<a name="M000005"></a>
|
173
|
+
|
174
|
+
<div class="method-heading">
|
175
|
+
<a href="#M000005" class="method-signature">
|
176
|
+
<span class="method-name">exists?</span><span class="method-args">(name)</span>
|
177
|
+
</a>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
<div class="method-description">
|
181
|
+
<p>
|
182
|
+
Checks whether or not configuration parameter exists.
|
183
|
+
</p>
|
184
|
+
<p><a class="source-toggle" href="#"
|
185
|
+
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
186
|
+
<div class="method-source-code" id="M000005-source">
|
187
|
+
<pre>
|
188
|
+
<span class="ruby-comment cmt"># File lib/store.rb, line 30</span>
|
189
|
+
30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">name</span>)
|
190
|
+
31: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@parameters</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>].<span class="ruby-identifier">nil?</span>
|
191
|
+
32: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">name</span>)
|
192
|
+
33: <span class="ruby-keyword kw">end</span>
|
193
|
+
</pre>
|
194
|
+
</div>
|
195
|
+
</div>
|
196
|
+
</div>
|
197
|
+
|
198
|
+
<div id="method-M000004" class="method-detail">
|
199
|
+
<a name="M000004"></a>
|
200
|
+
|
201
|
+
<div class="method-heading">
|
202
|
+
<a href="#M000004" class="method-signature">
|
203
|
+
<span class="method-name">method_missing</span><span class="method-args">(sym, *args)</span>
|
204
|
+
</a>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<div class="method-description">
|
208
|
+
<p>
|
209
|
+
If a method is called with an = at the end, then that method name, minus
|
210
|
+
the equal sign is added to the parameter list as a key, and it‘s
|
211
|
+
*args become the value for that key. Eventually the keys become method
|
212
|
+
names. If a method is called without an = sign at the end then the value
|
213
|
+
from the parameters hash is returned, if it exists.
|
214
|
+
</p>
|
215
|
+
<p><a class="source-toggle" href="#"
|
216
|
+
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
217
|
+
<div class="method-source-code" id="M000004-source">
|
218
|
+
<pre>
|
219
|
+
<span class="ruby-comment cmt"># File lib/store.rb, line 19</span>
|
220
|
+
19: <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>)
|
221
|
+
20: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sym</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/(.+)=$/</span>)
|
222
|
+
21: <span class="ruby-ivar">@parameters</span>[<span class="ruby-identifier">sym</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">"="</span>, <span class="ruby-value str">''</span>).<span class="ruby-identifier">to_sym</span>] = <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
|
223
|
+
22: <span class="ruby-keyword kw">else</span>
|
224
|
+
23: <span class="ruby-identifier">val</span> = <span class="ruby-ivar">@parameters</span>[<span class="ruby-identifier">sym</span>]
|
225
|
+
24: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">val</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">nil?</span>
|
226
|
+
25: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">handle_missing_parameter</span>(<span class="ruby-identifier">sym</span>)
|
227
|
+
26: <span class="ruby-keyword kw">end</span>
|
228
|
+
27: <span class="ruby-keyword kw">end</span>
|
229
|
+
</pre>
|
230
|
+
</div>
|
231
|
+
</div>
|
232
|
+
</div>
|
233
|
+
|
234
|
+
<div id="method-M000006" class="method-detail">
|
235
|
+
<a name="M000006"></a>
|
236
|
+
|
237
|
+
<div class="method-heading">
|
238
|
+
<a href="#M000006" class="method-signature">
|
239
|
+
<span class="method-name">namespace</span><span class="method-args">(name) {|self.send(name.to_sym)| ...}</span>
|
240
|
+
</a>
|
241
|
+
</div>
|
242
|
+
|
243
|
+
<div class="method-description">
|
244
|
+
<p>
|
245
|
+
Used to create ‘namespaces’ around a set of configuration
|
246
|
+
parameters.
|
247
|
+
</p>
|
248
|
+
<p><a class="source-toggle" href="#"
|
249
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
250
|
+
<div class="method-source-code" id="M000006-source">
|
251
|
+
<pre>
|
252
|
+
<span class="ruby-comment cmt"># File lib/store.rb, line 36</span>
|
253
|
+
36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">namespace</span>(<span class="ruby-identifier">name</span>)
|
254
|
+
37: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">name</span>)
|
255
|
+
38: <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>)
|
256
|
+
39: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">configatron</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">name</span>)
|
257
|
+
40: <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">configatron</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>)
|
258
|
+
41: <span class="ruby-keyword kw">else</span>
|
259
|
+
42: <span class="ruby-identifier">ns</span> = <span class="ruby-constant">Configatron</span><span class="ruby-operator">::</span><span class="ruby-constant">Store</span>.<span class="ruby-identifier">new</span>
|
260
|
+
43: <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">ns</span>
|
261
|
+
44: <span class="ruby-ivar">@parameters</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">ns</span>
|
262
|
+
45: <span class="ruby-keyword kw">end</span>
|
263
|
+
46: <span class="ruby-keyword kw">end</span>
|
264
|
+
</pre>
|
265
|
+
</div>
|
266
|
+
</div>
|
267
|
+
</div>
|
268
|
+
|
269
|
+
|
270
|
+
</div>
|
271
|
+
|
272
|
+
|
273
|
+
</div>
|
274
|
+
|
275
|
+
|
276
|
+
<div id="validator-badges">
|
277
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
278
|
+
</div>
|
279
|
+
|
280
|
+
</body>
|
281
|
+
</html>
|
@@ -0,0 +1,151 @@
|
|
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: Kernel</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">Kernel</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/kernel_rb.html">
|
59
|
+
lib/kernel.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="#M000013">configatron</a>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
<!-- if includes -->
|
91
|
+
|
92
|
+
<div id="section">
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
<!-- if method_list -->
|
102
|
+
<div id="methods">
|
103
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
104
|
+
|
105
|
+
<div id="method-M000013" class="method-detail">
|
106
|
+
<a name="M000013"></a>
|
107
|
+
|
108
|
+
<div class="method-heading">
|
109
|
+
<a href="#M000013" class="method-signature">
|
110
|
+
<span class="method-name">configatron</span><span class="method-args">(&block)</span>
|
111
|
+
</a>
|
112
|
+
</div>
|
113
|
+
|
114
|
+
<div class="method-description">
|
115
|
+
<p>
|
116
|
+
If called without a block it will return the <a
|
117
|
+
href="Configatron/Configuration.html">Configatron::Configuration</a>
|
118
|
+
instance. If called with a block then it will call the
|
119
|
+
Configatron::Configatron configure method and yield up a <a
|
120
|
+
href="Configatron/Store.html">Configatron::Store</a> object.
|
121
|
+
</p>
|
122
|
+
<p><a class="source-toggle" href="#"
|
123
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
124
|
+
<div class="method-source-code" id="M000013-source">
|
125
|
+
<pre>
|
126
|
+
<span class="ruby-comment cmt"># File lib/kernel.rb, line 6</span>
|
127
|
+
6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configatron</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
128
|
+
7: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
129
|
+
8: <span class="ruby-constant">Configatron</span><span class="ruby-operator">::</span><span class="ruby-constant">Configuration</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
130
|
+
9: <span class="ruby-keyword kw">else</span>
|
131
|
+
10: <span class="ruby-constant">Configatron</span><span class="ruby-operator">::</span><span class="ruby-constant">Configuration</span>.<span class="ruby-identifier">instance</span>
|
132
|
+
11: <span class="ruby-keyword kw">end</span>
|
133
|
+
12: <span class="ruby-keyword kw">end</span>
|
134
|
+
</pre>
|
135
|
+
</div>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
|
139
|
+
|
140
|
+
</div>
|
141
|
+
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
<div id="validator-badges">
|
147
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
</body>
|
151
|
+
</html>
|
data/doc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Fri, 29 Aug 2008 12:14:31 -0400
|
@@ -0,0 +1,230 @@
|
|
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>File: README</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="fileHeader">
|
50
|
+
<h1>README</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>README
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Fri Aug 29 12:07:47 -0400 2008</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<h1>Configatron</h1>
|
73
|
+
<p>
|
74
|
+
Configatron makes configuring your applications and scripts incredibly
|
75
|
+
easy. No longer is a there a need to use constants or global variables. Now
|
76
|
+
you can use a simple and painless system to configure your life. And,
|
77
|
+
because it‘s all Ruby, you can do any crazy thing you would like to!
|
78
|
+
</p>
|
79
|
+
<h2>Examples</h2>
|
80
|
+
<h3>Simple</h3>
|
81
|
+
<pre>
|
82
|
+
configatron do |config|
|
83
|
+
config.email = "mark@mackframework.com"
|
84
|
+
config.database_url = "postgres://localhost/mack_framework_rocks"
|
85
|
+
# etc...
|
86
|
+
end
|
87
|
+
</pre>
|
88
|
+
<p>
|
89
|
+
Now, anywhere in your code you can do the following:
|
90
|
+
</p>
|
91
|
+
<pre>
|
92
|
+
configatron.email # => "mark@mackframework.com"
|
93
|
+
configatron.database_url # => "postgres://localhost/mack_framework_rocks"
|
94
|
+
</pre>
|
95
|
+
<p>
|
96
|
+
Viola! Simple as can be.
|
97
|
+
</p>
|
98
|
+
<p>
|
99
|
+
Now you‘re saying, what if I want to have a ‘default’ set
|
100
|
+
of options, but then override them later, based on other information?
|
101
|
+
Simple again. Let‘s use our above example. We‘ve configured our
|
102
|
+
‘database_url’ option to be
|
103
|
+
"postgres://localhost/mack_framework_rocks". The problem with
|
104
|
+
that is that is our production database url, not our development url. Fair
|
105
|
+
enough, all you have to do is redeclare it:
|
106
|
+
</p>
|
107
|
+
<pre>
|
108
|
+
configatron do |config|
|
109
|
+
config.database_url = "postgres://localhost/mack_framework_rocks_development"
|
110
|
+
end
|
111
|
+
</pre>
|
112
|
+
<p>
|
113
|
+
becomes:
|
114
|
+
</p>
|
115
|
+
<pre>
|
116
|
+
configatron.email # => "mark@mackframework.com"
|
117
|
+
configatron.database_url # => "postgres://localhost/mack_framework_rocks_development"
|
118
|
+
</pre>
|
119
|
+
<p>
|
120
|
+
Notice how our other configuration parameters haven‘t changed? Cool,
|
121
|
+
eh?
|
122
|
+
</p>
|
123
|
+
<h3>Namespaces</h3>
|
124
|
+
<p>
|
125
|
+
The question that should be on your lips is what I need to have namespaced
|
126
|
+
configuration parameters. It‘s easy! Configatron allows you to create
|
127
|
+
namespaces.
|
128
|
+
</p>
|
129
|
+
<pre>
|
130
|
+
configatron do |config|
|
131
|
+
config.website_url = "http://www.mackframework.com"
|
132
|
+
config.namespace(:email) do |email|
|
133
|
+
email.namespace(:pop) do |pop|
|
134
|
+
pop.address = "pop.example.com"
|
135
|
+
pop.port = "110"
|
136
|
+
# etc ...
|
137
|
+
end
|
138
|
+
email.namespace(:smtp) do |smtp|
|
139
|
+
smtp.address = "smtp.example.com"
|
140
|
+
smtp.port = "25"
|
141
|
+
# etc ...
|
142
|
+
end
|
143
|
+
end
|
144
|
+
# etc...
|
145
|
+
end
|
146
|
+
</pre>
|
147
|
+
<p>
|
148
|
+
becomes:
|
149
|
+
</p>
|
150
|
+
<pre>
|
151
|
+
configatron.email.pop.address # => "pop.example.com"
|
152
|
+
configatron.email.smtp.address # => "smtp.example.com"
|
153
|
+
configatron.website_url # => "http://www.mackframework.com"
|
154
|
+
</pre>
|
155
|
+
<p>
|
156
|
+
Configatron allows you to nest namespaces to your hearts content! Just keep
|
157
|
+
going, it‘s that easy.
|
158
|
+
</p>
|
159
|
+
<p>
|
160
|
+
Enjoy!
|
161
|
+
</p>
|
162
|
+
<h2>Contact</h2>
|
163
|
+
<p>
|
164
|
+
Please mail bugs, suggestions and patches to
|
165
|
+
<bugs@mackframework.com>.
|
166
|
+
</p>
|
167
|
+
<p>
|
168
|
+
On the web at: <a
|
169
|
+
href="http://www.mackframework.com">www.mackframework.com</a>
|
170
|
+
</p>
|
171
|
+
<h2>License and Copyright</h2>
|
172
|
+
<p>
|
173
|
+
Copyright (C) 2008 Mark Bates, <a
|
174
|
+
href="http://www.mackframework.com">www.mackframework.com</a>
|
175
|
+
</p>
|
176
|
+
<p>
|
177
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
178
|
+
copy of this software and associated documentation files (the
|
179
|
+
"Software"), to deal in the Software without restriction,
|
180
|
+
including without limitation the rights to use, copy, modify, merge,
|
181
|
+
publish, distribute, sublicense, and/or sell copies of the Software, and to
|
182
|
+
permit persons to whom the Software is furnished to do so, subject to the
|
183
|
+
following conditions:
|
184
|
+
</p>
|
185
|
+
<p>
|
186
|
+
The above copyright notice and this permission notice shall be included in
|
187
|
+
all copies or substantial portions of the Software.
|
188
|
+
</p>
|
189
|
+
<p>
|
190
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
191
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
192
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
193
|
+
NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
194
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
195
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
196
|
+
DEALINGS IN THE SOFTWARE.
|
197
|
+
</p>
|
198
|
+
|
199
|
+
</div>
|
200
|
+
|
201
|
+
|
202
|
+
</div>
|
203
|
+
|
204
|
+
|
205
|
+
</div>
|
206
|
+
|
207
|
+
|
208
|
+
<!-- if includes -->
|
209
|
+
|
210
|
+
<div id="section">
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<!-- if method_list -->
|
220
|
+
|
221
|
+
|
222
|
+
</div>
|
223
|
+
|
224
|
+
|
225
|
+
<div id="validator-badges">
|
226
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
227
|
+
</div>
|
228
|
+
|
229
|
+
</body>
|
230
|
+
</html>
|