rconfig 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +7 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/Rakefile +11 -8
- data/doc/Array.html +184 -0
- data/doc/Hash.html +360 -0
- data/doc/NilClass.html +233 -0
- data/doc/RConfig.html +328 -0
- data/doc/RConfig/Callbacks.html +295 -0
- data/doc/RConfig/Cascade.html +316 -0
- data/doc/RConfig/Config.html +441 -0
- data/doc/RConfig/ConfigError.html +187 -0
- data/doc/RConfig/Constants.html +271 -0
- data/doc/RConfig/CoreMethods.html +814 -0
- data/doc/RConfig/DisabledLogger.html +424 -0
- data/doc/RConfig/Exceptions.html +266 -0
- data/doc/RConfig/Generators.html +186 -0
- data/doc/RConfig/Generators/InstallGenerator.html +233 -0
- data/doc/RConfig/InvalidLoadPathError.html +187 -0
- data/doc/RConfig/LoadPaths.html +375 -0
- data/doc/RConfig/Logger.html +184 -0
- data/doc/RConfig/PropertiesFile.html +399 -0
- data/doc/RConfig/Reload.html +481 -0
- data/doc/RConfig/Settings.html +188 -0
- data/doc/RConfig/Utils.html +841 -0
- data/doc/README_rdoc.html +331 -0
- data/doc/String.html +184 -0
- data/doc/created.rid +21 -1
- data/doc/index.html +423 -20
- data/doc/lib/generators/rconfig/install_generator_rb.html +52 -0
- data/doc/lib/generators/rconfig/templates/rconfig_rb.html +56 -0
- data/doc/lib/rconfig/callbacks_rb.html +52 -0
- data/doc/lib/rconfig/cascade_rb.html +52 -0
- data/doc/lib/rconfig/config_rb.html +61 -0
- data/doc/lib/rconfig/constants_rb.html +52 -0
- data/doc/lib/rconfig/core_ext/array_rb.html +52 -0
- data/doc/lib/rconfig/core_ext/hash_rb.html +61 -0
- data/doc/lib/rconfig/core_ext/nil_rb.html +52 -0
- data/doc/lib/rconfig/core_ext/string_rb.html +52 -0
- data/doc/lib/rconfig/core_methods_rb.html +55 -0
- data/doc/lib/rconfig/exceptions_rb.html +58 -0
- data/doc/lib/rconfig/load_paths_rb.html +52 -0
- data/doc/lib/rconfig/logger_rb.html +52 -0
- data/doc/lib/rconfig/properties_file_rb.html +93 -0
- data/doc/lib/rconfig/reload_rb.html +52 -0
- data/doc/lib/rconfig/settings_rb.html +52 -0
- data/doc/lib/rconfig/utils_rb.html +52 -0
- data/doc/lib/rconfig_rb.html +151 -0
- data/doc/rdoc.css +706 -0
- data/lib/rconfig.rb +1 -1
- data/lib/rconfig/load_paths.rb +2 -2
- data/lib/tasks/rdoc.rake +3 -4
- data/rconfig.gemspec +4 -2
- data/spec/config/erb_contents.yml +3 -0
- data/spec/config/props_config.conf +18 -0
- data/spec/config/spec.yml +17 -0
- data/spec/config/xml_config.xml +22 -0
- data/spec/config2/.gitkeep +0 -0
- data/spec/rconfig/load_paths_spec.rb +37 -0
- data/spec/rconfig/reload_spec.rb +37 -0
- data/spec/rconfig_spec.rb +61 -3
- data/spec/spec_helper.rb +12 -8
- metadata +82 -40
- data/doc/classes/ClassVariables.html +0 -111
- data/doc/classes/ConfigError.html +0 -120
- data/doc/classes/ConfigHash.html +0 -354
- data/doc/classes/Constants.html +0 -226
- data/doc/classes/Hash.html +0 -269
- data/doc/classes/InvalidConfigPathError.html +0 -119
- data/doc/classes/Object.html +0 -220
- data/doc/classes/PropertiesFileParser.html +0 -282
- data/doc/classes/RConfig.html +0 -1745
- data/doc/files/README_rdoc.html +0 -271
- data/doc/files/lib/rconfig/class_variables_rb.html +0 -107
- data/doc/files/lib/rconfig/config_hash_rb.html +0 -114
- data/doc/files/lib/rconfig/constants_rb.html +0 -101
- data/doc/files/lib/rconfig/core_ext/hash_rb.html +0 -114
- data/doc/files/lib/rconfig/core_ext/object_rb.html +0 -101
- data/doc/files/lib/rconfig/core_ext_rb.html +0 -114
- data/doc/files/lib/rconfig/exceptions_rb.html +0 -110
- data/doc/files/lib/rconfig/properties_file_parser_rb.html +0 -146
- data/doc/files/lib/rconfig/rconfig_rb.html +0 -186
- data/doc/files/lib/rconfig_rb.html +0 -117
- data/doc/fr_class_index.html +0 -35
- data/doc/fr_file_index.html +0 -37
- data/doc/fr_method_index.html +0 -75
- data/doc/rdoc-style.css +0 -208
- data/lib/tasks/gem.rake +0 -14
- data/lib/tasks/spec.rake +0 -25
- data/spec/core_ext/object_spec.rb +0 -44
@@ -0,0 +1,295 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Module: RConfig::Callbacks</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="../js/jquery.js" type="text/javascript"
|
13
|
+
charset="utf-8"></script>
|
14
|
+
<script src="../js/thickbox-compressed.js" type="text/javascript"
|
15
|
+
charset="utf-8"></script>
|
16
|
+
<script src="../js/quicksearch.js" type="text/javascript"
|
17
|
+
charset="utf-8"></script>
|
18
|
+
<script src="../js/darkfish.js" type="text/javascript"
|
19
|
+
charset="utf-8"></script>
|
20
|
+
|
21
|
+
</head>
|
22
|
+
<body class="module">
|
23
|
+
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="home-metadata">
|
26
|
+
<div id="home-section" class="section">
|
27
|
+
<h3 class="section-header">
|
28
|
+
<a href="../index.html">Home</a>
|
29
|
+
<a href="../index.html#classes">Classes</a>
|
30
|
+
<a href="../index.html#methods">Methods</a>
|
31
|
+
</h3>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="file-metadata">
|
36
|
+
<div id="file-list-section" class="section">
|
37
|
+
<h3 class="section-header">In Files</h3>
|
38
|
+
<div class="section-body">
|
39
|
+
<ul>
|
40
|
+
|
41
|
+
<li><a href="../lib/rconfig/callbacks_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
+
class="thickbox" title="lib/rconfig/callbacks.rb">lib/rconfig/callbacks.rb</a></li>
|
43
|
+
|
44
|
+
</ul>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div id="class-metadata">
|
52
|
+
|
53
|
+
<!-- Parent Class -->
|
54
|
+
|
55
|
+
|
56
|
+
<!-- Namespace Contents -->
|
57
|
+
|
58
|
+
|
59
|
+
<!-- Method Quickref -->
|
60
|
+
|
61
|
+
<div id="method-list-section" class="section">
|
62
|
+
<h3 class="section-header">Methods</h3>
|
63
|
+
<ul class="link-list">
|
64
|
+
|
65
|
+
<li><a href="#method-i-fire_on_load">#fire_on_load</a></li>
|
66
|
+
|
67
|
+
<li><a href="#method-i-on_load">#on_load</a></li>
|
68
|
+
|
69
|
+
</ul>
|
70
|
+
</div>
|
71
|
+
|
72
|
+
|
73
|
+
<!-- Included Modules -->
|
74
|
+
|
75
|
+
</div>
|
76
|
+
|
77
|
+
<div id="project-metadata">
|
78
|
+
|
79
|
+
|
80
|
+
<div id="fileindex-section" class="section project-section">
|
81
|
+
<h3 class="section-header">Files</h3>
|
82
|
+
<ul>
|
83
|
+
|
84
|
+
<li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
|
85
|
+
|
86
|
+
</ul>
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
<div id="classindex-section" class="section project-section">
|
91
|
+
<h3 class="section-header">Class Index
|
92
|
+
<span class="search-toggle"><img src="../images/find.png"
|
93
|
+
height="16" width="16" alt="[+]"
|
94
|
+
title="show/hide quicksearch" /></span></h3>
|
95
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
96
|
+
<fieldset>
|
97
|
+
<legend>Quicksearch</legend>
|
98
|
+
<input type="text" name="quicksearch" value=""
|
99
|
+
class="quicksearch-field" />
|
100
|
+
</fieldset>
|
101
|
+
</form>
|
102
|
+
|
103
|
+
<ul class="link-list">
|
104
|
+
|
105
|
+
<li><a href="../RConfig.html">RConfig</a></li>
|
106
|
+
|
107
|
+
<li><a href="../RConfig/Callbacks.html">RConfig::Callbacks</a></li>
|
108
|
+
|
109
|
+
<li><a href="../RConfig/Cascade.html">RConfig::Cascade</a></li>
|
110
|
+
|
111
|
+
<li><a href="../RConfig/Config.html">RConfig::Config</a></li>
|
112
|
+
|
113
|
+
<li><a href="../RConfig/ConfigError.html">RConfig::ConfigError</a></li>
|
114
|
+
|
115
|
+
<li><a href="../RConfig/Constants.html">RConfig::Constants</a></li>
|
116
|
+
|
117
|
+
<li><a href="../RConfig/CoreMethods.html">RConfig::CoreMethods</a></li>
|
118
|
+
|
119
|
+
<li><a href="../RConfig/DisabledLogger.html">RConfig::DisabledLogger</a></li>
|
120
|
+
|
121
|
+
<li><a href="../RConfig/Exceptions.html">RConfig::Exceptions</a></li>
|
122
|
+
|
123
|
+
<li><a href="../RConfig/Generators.html">RConfig::Generators</a></li>
|
124
|
+
|
125
|
+
<li><a href="../RConfig/Generators/InstallGenerator.html">RConfig::Generators::InstallGenerator</a></li>
|
126
|
+
|
127
|
+
<li><a href="../RConfig/InvalidLoadPathError.html">RConfig::InvalidLoadPathError</a></li>
|
128
|
+
|
129
|
+
<li><a href="../RConfig/LoadPaths.html">RConfig::LoadPaths</a></li>
|
130
|
+
|
131
|
+
<li><a href="../RConfig/PropertiesFile.html">RConfig::PropertiesFile</a></li>
|
132
|
+
|
133
|
+
<li><a href="../RConfig/Reload.html">RConfig::Reload</a></li>
|
134
|
+
|
135
|
+
<li><a href="../RConfig/Settings.html">RConfig::Settings</a></li>
|
136
|
+
|
137
|
+
<li><a href="../RConfig/Utils.html">RConfig::Utils</a></li>
|
138
|
+
|
139
|
+
<li><a href="../Array.html">Array</a></li>
|
140
|
+
|
141
|
+
<li><a href="../Hash.html">Hash</a></li>
|
142
|
+
|
143
|
+
<li><a href="../NilClass.html">NilClass</a></li>
|
144
|
+
|
145
|
+
<li><a href="../String.html">String</a></li>
|
146
|
+
|
147
|
+
</ul>
|
148
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
149
|
+
</div>
|
150
|
+
|
151
|
+
|
152
|
+
</div>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
<div id="documentation">
|
156
|
+
<h1 class="module">RConfig::Callbacks</h1>
|
157
|
+
|
158
|
+
<div id="description">
|
159
|
+
|
160
|
+
</div>
|
161
|
+
|
162
|
+
<!-- Constants -->
|
163
|
+
|
164
|
+
|
165
|
+
<!-- Attributes -->
|
166
|
+
|
167
|
+
|
168
|
+
<!-- Methods -->
|
169
|
+
|
170
|
+
<div id="public-instance-method-details" class="method-section section">
|
171
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
172
|
+
|
173
|
+
|
174
|
+
<div id="fire-on-load-method" class="method-detail ">
|
175
|
+
<a name="method-i-fire_on_load"></a>
|
176
|
+
|
177
|
+
<div class="method-heading">
|
178
|
+
|
179
|
+
<span class="method-name">fire_on_load</span><span
|
180
|
+
class="method-args">(name)</span>
|
181
|
+
<span class="method-click-advice">click to toggle source</span>
|
182
|
+
|
183
|
+
</div>
|
184
|
+
|
185
|
+
<div class="method-description">
|
186
|
+
|
187
|
+
<p>
|
188
|
+
Executes all of the reload callbacks registered to the specified config
|
189
|
+
name, and all of the callbacks registered to run on any config, as
|
190
|
+
specified by the :ANY symbol.
|
191
|
+
</p>
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
<div class="method-source-code"
|
196
|
+
id="fire-on-load-source">
|
197
|
+
<pre>
|
198
|
+
<span class="ruby-comment cmt"># File lib/rconfig/callbacks.rb, line 38</span>
|
199
|
+
38: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fire_on_load</span>(<span class="ruby-identifier">name</span>)
|
200
|
+
39: <span class="ruby-identifier">procs</span> = (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">callbacks</span>[<span class="ruby-value str">'ANY'</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">RConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">EMPTY_ARRAY</span>) <span class="ruby-operator">+</span> (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">callbacks</span>[<span class="ruby-identifier">name</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">RConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">EMPTY_ARRAY</span>)
|
201
|
+
40: <span class="ruby-identifier">procs</span>.<span class="ruby-identifier">uniq!</span>
|
202
|
+
41: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">"fire_on_load(#{name.inspect}): callbacks[#{procs.inspect}]"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">procs</span>.<span class="ruby-identifier">empty?</span>
|
203
|
+
42: <span class="ruby-identifier">procs</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">proc</span><span class="ruby-operator">|</span> <span class="ruby-identifier">proc</span>.<span class="ruby-identifier">call</span>() }
|
204
|
+
43: <span class="ruby-keyword kw">end</span></pre>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
</div>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
</div>
|
213
|
+
|
214
|
+
|
215
|
+
<div id="on-load-method" class="method-detail ">
|
216
|
+
<a name="method-i-on_load"></a>
|
217
|
+
|
218
|
+
<div class="method-heading">
|
219
|
+
|
220
|
+
<span class="method-name">on_load</span><span
|
221
|
+
class="method-args">(*args, &blk)</span>
|
222
|
+
<span class="method-click-advice">click to toggle source</span>
|
223
|
+
|
224
|
+
</div>
|
225
|
+
|
226
|
+
<div class="method-description">
|
227
|
+
|
228
|
+
<p>
|
229
|
+
Register a callback when a config has been reloaded. If no config name is
|
230
|
+
specified, the callback will be registered under the name :ANY. The name
|
231
|
+
:ANY will register a callback for any config file change.
|
232
|
+
</p>
|
233
|
+
<p>
|
234
|
+
Example:
|
235
|
+
</p>
|
236
|
+
<pre>
|
237
|
+
class MyClass
|
238
|
+
self.my_config = { }
|
239
|
+
RConfig.on_load(:cache) do
|
240
|
+
self.my_config = { }
|
241
|
+
end
|
242
|
+
def my_config
|
243
|
+
self.my_config ||= something_expensive_thing_on_config(RConfig.cache.memory_limit)
|
244
|
+
end
|
245
|
+
end</pre>
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
<div class="method-source-code"
|
250
|
+
id="on-load-source">
|
251
|
+
<pre>
|
252
|
+
<span class="ruby-comment cmt"># File lib/rconfig/callbacks.rb, line 21</span>
|
253
|
+
21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">on_load</span>(*<span class="ruby-identifier">args</span>, &<span class="ruby-identifier">blk</span>)
|
254
|
+
22: <span class="ruby-identifier">args</span> <span class="ruby-operator"><<</span> <span class="ruby-value">:ANY</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span>
|
255
|
+
23: <span class="ruby-identifier">proc</span> = <span class="ruby-identifier">blk</span>.<span class="ruby-identifier">to_proc</span>
|
256
|
+
24:
|
257
|
+
25: <span class="ruby-comment cmt"># Call proc on registration.</span>
|
258
|
+
26: <span class="ruby-identifier">proc</span>.<span class="ruby-identifier">call</span>()
|
259
|
+
27:
|
260
|
+
28: <span class="ruby-comment cmt"># Register callback proc.</span>
|
261
|
+
29: <span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
|
262
|
+
30: (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">callbacks</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-operator">||=</span> []) <span class="ruby-operator"><<</span> <span class="ruby-identifier">proc</span>
|
263
|
+
31: <span class="ruby-keyword kw">end</span>
|
264
|
+
32: <span class="ruby-keyword kw">end</span></pre>
|
265
|
+
</div>
|
266
|
+
|
267
|
+
</div>
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
</div>
|
273
|
+
|
274
|
+
|
275
|
+
</div>
|
276
|
+
|
277
|
+
|
278
|
+
</div>
|
279
|
+
|
280
|
+
|
281
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
282
|
+
|
283
|
+
<p>Disabled; run with --debug to generate this.</p>
|
284
|
+
|
285
|
+
</div>
|
286
|
+
|
287
|
+
<div id="validator-badges">
|
288
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
289
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
290
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
291
|
+
</div>
|
292
|
+
|
293
|
+
</body>
|
294
|
+
</html>
|
295
|
+
|
@@ -0,0 +1,316 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Module: RConfig::Cascade</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="../js/jquery.js" type="text/javascript"
|
13
|
+
charset="utf-8"></script>
|
14
|
+
<script src="../js/thickbox-compressed.js" type="text/javascript"
|
15
|
+
charset="utf-8"></script>
|
16
|
+
<script src="../js/quicksearch.js" type="text/javascript"
|
17
|
+
charset="utf-8"></script>
|
18
|
+
<script src="../js/darkfish.js" type="text/javascript"
|
19
|
+
charset="utf-8"></script>
|
20
|
+
|
21
|
+
</head>
|
22
|
+
<body class="module">
|
23
|
+
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="home-metadata">
|
26
|
+
<div id="home-section" class="section">
|
27
|
+
<h3 class="section-header">
|
28
|
+
<a href="../index.html">Home</a>
|
29
|
+
<a href="../index.html#classes">Classes</a>
|
30
|
+
<a href="../index.html#methods">Methods</a>
|
31
|
+
</h3>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="file-metadata">
|
36
|
+
<div id="file-list-section" class="section">
|
37
|
+
<h3 class="section-header">In Files</h3>
|
38
|
+
<div class="section-body">
|
39
|
+
<ul>
|
40
|
+
|
41
|
+
<li><a href="../lib/rconfig/cascade_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
+
class="thickbox" title="lib/rconfig/cascade.rb">lib/rconfig/cascade.rb</a></li>
|
43
|
+
|
44
|
+
</ul>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div id="class-metadata">
|
52
|
+
|
53
|
+
<!-- Parent Class -->
|
54
|
+
|
55
|
+
|
56
|
+
<!-- Namespace Contents -->
|
57
|
+
|
58
|
+
|
59
|
+
<!-- Method Quickref -->
|
60
|
+
|
61
|
+
<div id="method-list-section" class="section">
|
62
|
+
<h3 class="section-header">Methods</h3>
|
63
|
+
<ul class="link-list">
|
64
|
+
|
65
|
+
<li><a href="#method-i-overlay%3D">#overlay=</a></li>
|
66
|
+
|
67
|
+
<li><a href="#method-i-suffixes_for">#suffixes_for</a></li>
|
68
|
+
|
69
|
+
</ul>
|
70
|
+
</div>
|
71
|
+
|
72
|
+
|
73
|
+
<!-- Included Modules -->
|
74
|
+
|
75
|
+
<div id="includes-section" class="section">
|
76
|
+
<h3 class="section-header">Included Modules</h3>
|
77
|
+
<ul class="link-list">
|
78
|
+
|
79
|
+
|
80
|
+
<li><span class="include">Constants</span></li>
|
81
|
+
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
</div>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<div id="project-metadata">
|
89
|
+
|
90
|
+
|
91
|
+
<div id="fileindex-section" class="section project-section">
|
92
|
+
<h3 class="section-header">Files</h3>
|
93
|
+
<ul>
|
94
|
+
|
95
|
+
<li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
|
96
|
+
|
97
|
+
</ul>
|
98
|
+
</div>
|
99
|
+
|
100
|
+
|
101
|
+
<div id="classindex-section" class="section project-section">
|
102
|
+
<h3 class="section-header">Class Index
|
103
|
+
<span class="search-toggle"><img src="../images/find.png"
|
104
|
+
height="16" width="16" alt="[+]"
|
105
|
+
title="show/hide quicksearch" /></span></h3>
|
106
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
107
|
+
<fieldset>
|
108
|
+
<legend>Quicksearch</legend>
|
109
|
+
<input type="text" name="quicksearch" value=""
|
110
|
+
class="quicksearch-field" />
|
111
|
+
</fieldset>
|
112
|
+
</form>
|
113
|
+
|
114
|
+
<ul class="link-list">
|
115
|
+
|
116
|
+
<li><a href="../RConfig.html">RConfig</a></li>
|
117
|
+
|
118
|
+
<li><a href="../RConfig/Callbacks.html">RConfig::Callbacks</a></li>
|
119
|
+
|
120
|
+
<li><a href="../RConfig/Cascade.html">RConfig::Cascade</a></li>
|
121
|
+
|
122
|
+
<li><a href="../RConfig/Config.html">RConfig::Config</a></li>
|
123
|
+
|
124
|
+
<li><a href="../RConfig/ConfigError.html">RConfig::ConfigError</a></li>
|
125
|
+
|
126
|
+
<li><a href="../RConfig/Constants.html">RConfig::Constants</a></li>
|
127
|
+
|
128
|
+
<li><a href="../RConfig/CoreMethods.html">RConfig::CoreMethods</a></li>
|
129
|
+
|
130
|
+
<li><a href="../RConfig/DisabledLogger.html">RConfig::DisabledLogger</a></li>
|
131
|
+
|
132
|
+
<li><a href="../RConfig/Exceptions.html">RConfig::Exceptions</a></li>
|
133
|
+
|
134
|
+
<li><a href="../RConfig/Generators.html">RConfig::Generators</a></li>
|
135
|
+
|
136
|
+
<li><a href="../RConfig/Generators/InstallGenerator.html">RConfig::Generators::InstallGenerator</a></li>
|
137
|
+
|
138
|
+
<li><a href="../RConfig/InvalidLoadPathError.html">RConfig::InvalidLoadPathError</a></li>
|
139
|
+
|
140
|
+
<li><a href="../RConfig/LoadPaths.html">RConfig::LoadPaths</a></li>
|
141
|
+
|
142
|
+
<li><a href="../RConfig/PropertiesFile.html">RConfig::PropertiesFile</a></li>
|
143
|
+
|
144
|
+
<li><a href="../RConfig/Reload.html">RConfig::Reload</a></li>
|
145
|
+
|
146
|
+
<li><a href="../RConfig/Settings.html">RConfig::Settings</a></li>
|
147
|
+
|
148
|
+
<li><a href="../RConfig/Utils.html">RConfig::Utils</a></li>
|
149
|
+
|
150
|
+
<li><a href="../Array.html">Array</a></li>
|
151
|
+
|
152
|
+
<li><a href="../Hash.html">Hash</a></li>
|
153
|
+
|
154
|
+
<li><a href="../NilClass.html">NilClass</a></li>
|
155
|
+
|
156
|
+
<li><a href="../String.html">String</a></li>
|
157
|
+
|
158
|
+
</ul>
|
159
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
|
166
|
+
<div id="documentation">
|
167
|
+
<h1 class="module">RConfig::Cascade</h1>
|
168
|
+
|
169
|
+
<div id="description">
|
170
|
+
|
171
|
+
</div>
|
172
|
+
|
173
|
+
<!-- Constants -->
|
174
|
+
|
175
|
+
|
176
|
+
<!-- Attributes -->
|
177
|
+
|
178
|
+
|
179
|
+
<!-- Methods -->
|
180
|
+
|
181
|
+
<div id="public-instance-method-details" class="method-section section">
|
182
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
183
|
+
|
184
|
+
|
185
|
+
<div id="overlay--method" class="method-detail ">
|
186
|
+
<a name="method-i-overlay%3D"></a>
|
187
|
+
|
188
|
+
<div class="method-heading">
|
189
|
+
|
190
|
+
<span class="method-name">overlay=</span><span
|
191
|
+
class="method-args">(value)</span>
|
192
|
+
<span class="method-click-advice">click to toggle source</span>
|
193
|
+
|
194
|
+
</div>
|
195
|
+
|
196
|
+
<div class="method-description">
|
197
|
+
|
198
|
+
<p>
|
199
|
+
Sets a custome overlay for
|
200
|
+
</p>
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
<div class="method-source-code"
|
205
|
+
id="overlay--source">
|
206
|
+
<pre>
|
207
|
+
<span class="ruby-comment cmt"># File lib/rconfig/cascade.rb, line 7</span>
|
208
|
+
7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">overlay=</span>(<span class="ruby-identifier">value</span>)
|
209
|
+
8: <span class="ruby-identifier">reload</span>(<span class="ruby-keyword kw">false</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">overlay</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">value</span>
|
210
|
+
9: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">overlay</span> = <span class="ruby-identifier">value</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">freeze</span>
|
211
|
+
10: <span class="ruby-keyword kw">end</span></pre>
|
212
|
+
</div>
|
213
|
+
|
214
|
+
</div>
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
</div>
|
220
|
+
|
221
|
+
|
222
|
+
<div id="suffixes-for-method" class="method-detail ">
|
223
|
+
<a name="method-i-suffixes_for"></a>
|
224
|
+
|
225
|
+
<div class="method-heading">
|
226
|
+
|
227
|
+
<span class="method-name">suffixes_for</span><span
|
228
|
+
class="method-args">(name)</span>
|
229
|
+
<span class="method-click-advice">click to toggle source</span>
|
230
|
+
|
231
|
+
</div>
|
232
|
+
|
233
|
+
<div class="method-description">
|
234
|
+
|
235
|
+
<p>
|
236
|
+
Returns a list of suffixes to try for a given config name.
|
237
|
+
</p>
|
238
|
+
<p>
|
239
|
+
A config name with an explicit overlay (e.g.: ‘name_GB’)
|
240
|
+
overrides any current _overlay.
|
241
|
+
</p>
|
242
|
+
<p>
|
243
|
+
This allows code to specifically ask for config overlays for a particular
|
244
|
+
locale.
|
245
|
+
</p>
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
<div class="method-source-code"
|
250
|
+
id="suffixes-for-source">
|
251
|
+
<pre>
|
252
|
+
<span class="ruby-comment cmt"># File lib/rconfig/cascade.rb, line 21</span>
|
253
|
+
21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">suffixes_for</span>(<span class="ruby-identifier">name</span>)
|
254
|
+
22: <span class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>
|
255
|
+
23: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">suffixes</span>[<span class="ruby-identifier">name</span>] <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">begin</span>
|
256
|
+
24: <span class="ruby-identifier">ol</span> = <span class="ruby-identifier">overlay</span>
|
257
|
+
25: <span class="ruby-identifier">name_x</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">dup</span>
|
258
|
+
26: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name_x</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/_([A-Z]+)$/</span>, <span class="ruby-value str">''</span>)
|
259
|
+
27: <span class="ruby-identifier">ol</span> = <span class="ruby-node">$1</span>
|
260
|
+
28: <span class="ruby-keyword kw">end</span>
|
261
|
+
29: <span class="ruby-identifier">name_x</span>.<span class="ruby-identifier">freeze</span>
|
262
|
+
30: <span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ol</span>
|
263
|
+
31: <span class="ruby-identifier">ol_</span> = <span class="ruby-identifier">ol</span>.<span class="ruby-identifier">upcase</span>
|
264
|
+
32: <span class="ruby-identifier">ol</span> = <span class="ruby-identifier">ol</span>.<span class="ruby-identifier">downcase</span>
|
265
|
+
33: <span class="ruby-identifier">x</span> = []
|
266
|
+
34: <span class="ruby-constant">SUFFIXES</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">suffix</span><span class="ruby-operator">|</span>
|
267
|
+
35: <span class="ruby-comment cmt"># Standard, no overlay:</span>
|
268
|
+
36: <span class="ruby-comment cmt"># e.g.: database_<suffix>.yml</span>
|
269
|
+
37: <span class="ruby-identifier">x</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">suffix</span>
|
270
|
+
38:
|
271
|
+
39: <span class="ruby-comment cmt"># Overlay:</span>
|
272
|
+
40: <span class="ruby-comment cmt"># e.g.: database_(US|GB)_<suffix>.yml</span>
|
273
|
+
41: <span class="ruby-identifier">x</span> <span class="ruby-operator"><<</span> [<span class="ruby-identifier">ol_</span>, <span class="ruby-identifier">suffix</span>]
|
274
|
+
42: <span class="ruby-keyword kw">end</span>
|
275
|
+
43: [<span class="ruby-identifier">name_x</span>, <span class="ruby-identifier">x</span>.<span class="ruby-identifier">freeze</span>]
|
276
|
+
44: <span class="ruby-keyword kw">else</span>
|
277
|
+
45: [<span class="ruby-identifier">name</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">freeze</span>, <span class="ruby-constant">SUFFIXES</span>.<span class="ruby-identifier">freeze</span>]
|
278
|
+
46: <span class="ruby-keyword kw">end</span>
|
279
|
+
47: <span class="ruby-identifier">result</span>.<span class="ruby-identifier">freeze</span>
|
280
|
+
48:
|
281
|
+
49: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">"suffixes(#{name}) => #{result.inspect}"</span>
|
282
|
+
50:
|
283
|
+
51: <span class="ruby-identifier">result</span>
|
284
|
+
52: <span class="ruby-keyword kw">end</span>
|
285
|
+
53: <span class="ruby-keyword kw">end</span></pre>
|
286
|
+
</div>
|
287
|
+
|
288
|
+
</div>
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
</div>
|
294
|
+
|
295
|
+
|
296
|
+
</div>
|
297
|
+
|
298
|
+
|
299
|
+
</div>
|
300
|
+
|
301
|
+
|
302
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
303
|
+
|
304
|
+
<p>Disabled; run with --debug to generate this.</p>
|
305
|
+
|
306
|
+
</div>
|
307
|
+
|
308
|
+
<div id="validator-badges">
|
309
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
310
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
311
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
312
|
+
</div>
|
313
|
+
|
314
|
+
</body>
|
315
|
+
</html>
|
316
|
+
|