rconfig 0.4.2 → 0.4.3
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/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,399 @@
|
|
|
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>Class: RConfig::PropertiesFile</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="class">
|
|
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/properties_file_rb.html?TB_iframe=true&height=550&width=785"
|
|
42
|
+
class="thickbox" title="lib/rconfig/properties_file.rb">lib/rconfig/properties_file.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
|
+
<div id="parent-class-section" class="section">
|
|
56
|
+
<h3 class="section-header">Parent</h3>
|
|
57
|
+
|
|
58
|
+
<p class="link">Object</p>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
<!-- Namespace Contents -->
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
<!-- Method Quickref -->
|
|
67
|
+
|
|
68
|
+
<div id="method-list-section" class="section">
|
|
69
|
+
<h3 class="section-header">Methods</h3>
|
|
70
|
+
<ul class="link-list">
|
|
71
|
+
|
|
72
|
+
<li><a href="#method-c-parse">::parse</a></li>
|
|
73
|
+
|
|
74
|
+
<li><a href="#method-c-parse_references">::parse_references</a></li>
|
|
75
|
+
|
|
76
|
+
</ul>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
<!-- Included Modules -->
|
|
81
|
+
|
|
82
|
+
<div id="includes-section" class="section">
|
|
83
|
+
<h3 class="section-header">Included Modules</h3>
|
|
84
|
+
<ul class="link-list">
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
<li><span class="include">Singleton</span></li>
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
</ul>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<div id="project-metadata">
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
<div id="fileindex-section" class="section project-section">
|
|
99
|
+
<h3 class="section-header">Files</h3>
|
|
100
|
+
<ul>
|
|
101
|
+
|
|
102
|
+
<li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
|
|
103
|
+
|
|
104
|
+
</ul>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
<div id="classindex-section" class="section project-section">
|
|
109
|
+
<h3 class="section-header">Class Index
|
|
110
|
+
<span class="search-toggle"><img src="../images/find.png"
|
|
111
|
+
height="16" width="16" alt="[+]"
|
|
112
|
+
title="show/hide quicksearch" /></span></h3>
|
|
113
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
|
114
|
+
<fieldset>
|
|
115
|
+
<legend>Quicksearch</legend>
|
|
116
|
+
<input type="text" name="quicksearch" value=""
|
|
117
|
+
class="quicksearch-field" />
|
|
118
|
+
</fieldset>
|
|
119
|
+
</form>
|
|
120
|
+
|
|
121
|
+
<ul class="link-list">
|
|
122
|
+
|
|
123
|
+
<li><a href="../RConfig.html">RConfig</a></li>
|
|
124
|
+
|
|
125
|
+
<li><a href="../RConfig/Callbacks.html">RConfig::Callbacks</a></li>
|
|
126
|
+
|
|
127
|
+
<li><a href="../RConfig/Cascade.html">RConfig::Cascade</a></li>
|
|
128
|
+
|
|
129
|
+
<li><a href="../RConfig/Config.html">RConfig::Config</a></li>
|
|
130
|
+
|
|
131
|
+
<li><a href="../RConfig/ConfigError.html">RConfig::ConfigError</a></li>
|
|
132
|
+
|
|
133
|
+
<li><a href="../RConfig/Constants.html">RConfig::Constants</a></li>
|
|
134
|
+
|
|
135
|
+
<li><a href="../RConfig/CoreMethods.html">RConfig::CoreMethods</a></li>
|
|
136
|
+
|
|
137
|
+
<li><a href="../RConfig/DisabledLogger.html">RConfig::DisabledLogger</a></li>
|
|
138
|
+
|
|
139
|
+
<li><a href="../RConfig/Exceptions.html">RConfig::Exceptions</a></li>
|
|
140
|
+
|
|
141
|
+
<li><a href="../RConfig/Generators.html">RConfig::Generators</a></li>
|
|
142
|
+
|
|
143
|
+
<li><a href="../RConfig/Generators/InstallGenerator.html">RConfig::Generators::InstallGenerator</a></li>
|
|
144
|
+
|
|
145
|
+
<li><a href="../RConfig/InvalidLoadPathError.html">RConfig::InvalidLoadPathError</a></li>
|
|
146
|
+
|
|
147
|
+
<li><a href="../RConfig/LoadPaths.html">RConfig::LoadPaths</a></li>
|
|
148
|
+
|
|
149
|
+
<li><a href="../RConfig/PropertiesFile.html">RConfig::PropertiesFile</a></li>
|
|
150
|
+
|
|
151
|
+
<li><a href="../RConfig/Reload.html">RConfig::Reload</a></li>
|
|
152
|
+
|
|
153
|
+
<li><a href="../RConfig/Settings.html">RConfig::Settings</a></li>
|
|
154
|
+
|
|
155
|
+
<li><a href="../RConfig/Utils.html">RConfig::Utils</a></li>
|
|
156
|
+
|
|
157
|
+
<li><a href="../Array.html">Array</a></li>
|
|
158
|
+
|
|
159
|
+
<li><a href="../Hash.html">Hash</a></li>
|
|
160
|
+
|
|
161
|
+
<li><a href="../NilClass.html">NilClass</a></li>
|
|
162
|
+
|
|
163
|
+
<li><a href="../String.html">String</a></li>
|
|
164
|
+
|
|
165
|
+
</ul>
|
|
166
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
<div id="documentation">
|
|
174
|
+
<h1 class="class">RConfig::PropertiesFile</h1>
|
|
175
|
+
|
|
176
|
+
<div id="description">
|
|
177
|
+
|
|
178
|
+
</div>
|
|
179
|
+
|
|
180
|
+
<!-- Constants -->
|
|
181
|
+
|
|
182
|
+
<div id="constants-list" class="section">
|
|
183
|
+
<h3 class="section-header">Constants</h3>
|
|
184
|
+
<dl>
|
|
185
|
+
|
|
186
|
+
<dt><a name="COMMENT">COMMENT</a></dt>
|
|
187
|
+
|
|
188
|
+
<dd class="description"></dd>
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
<dt><a name="KEYVAL">KEYVAL</a></dt>
|
|
192
|
+
|
|
193
|
+
<dd class="description"></dd>
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
<dt><a name="QUOTES">QUOTES</a></dt>
|
|
197
|
+
|
|
198
|
+
<dd class="description"></dd>
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
<dt><a name="GROUP">GROUP</a></dt>
|
|
202
|
+
|
|
203
|
+
<dd class="description"></dd>
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
<dt><a name="NAMEGRP">NAMEGRP</a></dt>
|
|
207
|
+
|
|
208
|
+
<dd class="description"></dd>
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
<dt><a name="KEY_REF">KEY_REF</a></dt>
|
|
212
|
+
|
|
213
|
+
<dd class="description"></dd>
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
</dl>
|
|
217
|
+
</div>
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
<!-- Attributes -->
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
<!-- Methods -->
|
|
224
|
+
|
|
225
|
+
<div id="public-class-method-details" class="method-section section">
|
|
226
|
+
<h3 class="section-header">Public Class Methods</h3>
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
<div id="parse-method" class="method-detail ">
|
|
230
|
+
<a name="method-c-parse"></a>
|
|
231
|
+
|
|
232
|
+
<div class="method-heading">
|
|
233
|
+
|
|
234
|
+
<span class="method-name">parse</span><span
|
|
235
|
+
class="method-args">(config_file)</span>
|
|
236
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
237
|
+
|
|
238
|
+
</div>
|
|
239
|
+
|
|
240
|
+
<div class="method-description">
|
|
241
|
+
|
|
242
|
+
<p>
|
|
243
|
+
Parse config file and import data into hash to be stored in config.
|
|
244
|
+
</p>
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
<div class="method-source-code"
|
|
249
|
+
id="parse-source">
|
|
250
|
+
<pre>
|
|
251
|
+
<span class="ruby-comment cmt"># File lib/rconfig/properties_file.rb, line 49</span>
|
|
252
|
+
49: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">config_file</span>)
|
|
253
|
+
50: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">'Invalid config file name.'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">config_file</span>
|
|
254
|
+
51:
|
|
255
|
+
52: <span class="ruby-identifier">config</span> = {}
|
|
256
|
+
53:
|
|
257
|
+
54: <span class="ruby-comment cmt"># The config is top down.. anything after a [group] gets added as part</span>
|
|
258
|
+
55: <span class="ruby-comment cmt"># of that group until a new [group] is found. </span>
|
|
259
|
+
56: <span class="ruby-identifier">group</span>, <span class="ruby-identifier">topgrp</span> = <span class="ruby-keyword kw">nil</span>
|
|
260
|
+
57: <span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">"\n"</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span> <span class="ruby-comment cmt"># for each line in the config file</span>
|
|
261
|
+
58: <span class="ruby-identifier">line</span>.<span class="ruby-identifier">strip!</span>
|
|
262
|
+
59: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">COMMENT</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">line</span>) <span class="ruby-comment cmt"># skip comments (lines that state with '#')</span>
|
|
263
|
+
60: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">KEYVAL</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">line</span>) <span class="ruby-comment cmt"># if this line is a config property</span>
|
|
264
|
+
61: <span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-constant">KEYVAL</span>, <span class="ruby-value">2</span>) <span class="ruby-comment cmt"># parse key and value from line</span>
|
|
265
|
+
62: <span class="ruby-identifier">key</span> = <span class="ruby-identifier">key</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">strip</span>
|
|
266
|
+
63: <span class="ruby-identifier">val</span> = <span class="ruby-identifier">val</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">strip</span>
|
|
267
|
+
64: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span>
|
|
268
|
+
65: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">QUOTES</span> <span class="ruby-comment cmt"># if the value is in quotes</span>
|
|
269
|
+
66: <span class="ruby-identifier">value</span> = <span class="ruby-node">$1</span> <span class="ruby-comment cmt"># strip out value from quotes</span>
|
|
270
|
+
67: <span class="ruby-keyword kw">else</span>
|
|
271
|
+
68: <span class="ruby-identifier">value</span> = <span class="ruby-identifier">val</span> <span class="ruby-comment cmt"># otherwise, leave as-is</span>
|
|
272
|
+
69: <span class="ruby-keyword kw">end</span>
|
|
273
|
+
70: <span class="ruby-keyword kw">else</span>
|
|
274
|
+
71: <span class="ruby-identifier">value</span> = <span class="ruby-value str">''</span> <span class="ruby-comment cmt"># if value was nil, set it to empty string</span>
|
|
275
|
+
72: <span class="ruby-keyword kw">end</span>
|
|
276
|
+
73:
|
|
277
|
+
74: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">topgrp</span> <span class="ruby-comment cmt"># If there was a top-level named group, then there must be a group.</span>
|
|
278
|
+
75: <span class="ruby-identifier">config</span>[<span class="ruby-identifier">topgrp</span>][<span class="ruby-identifier">group</span>][<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span> <span class="ruby-comment cmt"># so add the prop to the named group</span>
|
|
279
|
+
76: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">group</span> <span class="ruby-comment cmt"># if this property is part of a group</span>
|
|
280
|
+
77: <span class="ruby-identifier">config</span>[<span class="ruby-identifier">group</span>][<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span> <span class="ruby-comment cmt"># then add it to the group</span>
|
|
281
|
+
78: <span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># otherwise... </span>
|
|
282
|
+
79: <span class="ruby-identifier">config</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span> <span class="ruby-comment cmt"># add the prop to top-level config</span>
|
|
283
|
+
80: <span class="ruby-keyword kw">end</span>
|
|
284
|
+
81:
|
|
285
|
+
82: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">match</span> = <span class="ruby-constant">NAMEGRP</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">line</span>) <span class="ruby-comment cmt"># This line is a named group (i.e. [env "test"], [env "qa"], [env "production"])</span>
|
|
286
|
+
83: <span class="ruby-identifier">topgrp</span>, <span class="ruby-identifier">group</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">to_a</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>] <span class="ruby-comment cmt"># There can be multiple groups within a single top-level group</span>
|
|
287
|
+
84: <span class="ruby-identifier">config</span>[<span class="ruby-identifier">topgrp</span>] <span class="ruby-operator">||=</span> {} <span class="ruby-comment cmt"># add group to top-level group</span>
|
|
288
|
+
85: <span class="ruby-identifier">config</span>[<span class="ruby-identifier">topgrp</span>][<span class="ruby-identifier">group</span>] <span class="ruby-operator">||=</span> {} <span class="ruby-comment cmt"># add name of group as subgroup (properties are added to subgroup)</span>
|
|
289
|
+
86:
|
|
290
|
+
87: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">match</span> = <span class="ruby-constant">GROUP</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">line</span>) <span class="ruby-comment cmt"># if this line is a config group</span>
|
|
291
|
+
88: <span class="ruby-identifier">group</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">to_a</span>[<span class="ruby-value">1</span>] <span class="ruby-comment cmt"># parse the group name from line</span>
|
|
292
|
+
89: <span class="ruby-identifier">topgrp</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-comment cmt"># we got a new group with no namespace, so reset topgrp</span>
|
|
293
|
+
90: <span class="ruby-identifier">config</span>[<span class="ruby-identifier">group</span>] <span class="ruby-operator">||=</span> {} <span class="ruby-comment cmt"># add group to top-level config</span>
|
|
294
|
+
91: <span class="ruby-keyword kw">end</span>
|
|
295
|
+
92: <span class="ruby-keyword kw">end</span>
|
|
296
|
+
93: <span class="ruby-keyword kw">end</span>
|
|
297
|
+
94:
|
|
298
|
+
95: <span class="ruby-comment cmt"># Pre-populate the values that refer to other properties</span>
|
|
299
|
+
96: <span class="ruby-comment cmt"># Example:</span>
|
|
300
|
+
97: <span class="ruby-comment cmt"># root_path = /path/to/root</span>
|
|
301
|
+
98: <span class="ruby-comment cmt"># image_path = %{root_path}/images</span>
|
|
302
|
+
99: <span class="ruby-identifier">config</span> = <span class="ruby-identifier">parse_references</span>(<span class="ruby-identifier">config</span>)
|
|
303
|
+
100:
|
|
304
|
+
101: <span class="ruby-identifier">config</span> <span class="ruby-comment cmt"># return config hash</span>
|
|
305
|
+
102: <span class="ruby-keyword kw">end</span></pre>
|
|
306
|
+
</div>
|
|
307
|
+
|
|
308
|
+
</div>
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
</div>
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
<div id="parse-references-method" class="method-detail ">
|
|
317
|
+
<a name="method-c-parse_references"></a>
|
|
318
|
+
|
|
319
|
+
<div class="method-heading">
|
|
320
|
+
|
|
321
|
+
<span class="method-name">parse_references</span><span
|
|
322
|
+
class="method-args">(hash, config=nil)</span>
|
|
323
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
324
|
+
|
|
325
|
+
</div>
|
|
326
|
+
|
|
327
|
+
<div class="method-description">
|
|
328
|
+
|
|
329
|
+
<p>
|
|
330
|
+
Recursively checks all the values in the hash for references to other
|
|
331
|
+
properties, and replaces the references with the actual values. The syntax
|
|
332
|
+
for referring to another property in the config file is the ley of the
|
|
333
|
+
property wrapped in curly braces, preceded by a percent sign. If the
|
|
334
|
+
property is in a group, then the full namespace must be used.
|
|
335
|
+
</p>
|
|
336
|
+
<p>
|
|
337
|
+
Example:
|
|
338
|
+
</p>
|
|
339
|
+
<pre>
|
|
340
|
+
root_path = /path/to/root # In this property file snippet
|
|
341
|
+
image_path = %{root_path}/images # image path refers to root path</pre>
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
<div class="method-source-code"
|
|
346
|
+
id="parse-references-source">
|
|
347
|
+
<pre>
|
|
348
|
+
<span class="ruby-comment cmt"># File lib/rconfig/properties_file.rb, line 116</span>
|
|
349
|
+
116: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse_references</span> <span class="ruby-identifier">hash</span>, <span class="ruby-identifier">config</span>=<span class="ruby-keyword kw">nil</span>
|
|
350
|
+
117: <span class="ruby-identifier">config</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">dup</span>
|
|
351
|
+
118:
|
|
352
|
+
119: <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
|
|
353
|
+
120: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">val</span>
|
|
354
|
+
121: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Hash</span>
|
|
355
|
+
122: <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">parse_references</span>(<span class="ruby-identifier">val</span>, <span class="ruby-identifier">config</span>)
|
|
356
|
+
123: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span>
|
|
357
|
+
124: <span class="ruby-identifier">pre</span>, <span class="ruby-identifier">ref</span>, <span class="ruby-identifier">post</span> = <span class="ruby-constant">KEY_REF</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">val</span>).<span class="ruby-identifier">to_a</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>]
|
|
358
|
+
125: <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ref</span>
|
|
359
|
+
126: <span class="ruby-identifier">ref</span> = <span class="ruby-identifier">ref</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'.'</span>).<span class="ruby-identifier">inject</span>(<span class="ruby-identifier">config</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">c</span>,<span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">c</span>[<span class="ruby-identifier">i</span>] }
|
|
360
|
+
127: [<span class="ruby-identifier">pre</span>, <span class="ruby-identifier">ref</span>, <span class="ruby-identifier">post</span>].<span class="ruby-identifier">join</span>
|
|
361
|
+
128: <span class="ruby-keyword kw">else</span>
|
|
362
|
+
129: <span class="ruby-identifier">val</span>
|
|
363
|
+
130: <span class="ruby-keyword kw">end</span>
|
|
364
|
+
131: <span class="ruby-keyword kw">end</span>
|
|
365
|
+
132: <span class="ruby-keyword kw">end</span>
|
|
366
|
+
133:
|
|
367
|
+
134: <span class="ruby-identifier">hash</span>
|
|
368
|
+
135: <span class="ruby-keyword kw">end</span></pre>
|
|
369
|
+
</div>
|
|
370
|
+
|
|
371
|
+
</div>
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
</div>
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
</div>
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
</div>
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
|
386
|
+
|
|
387
|
+
<p>Disabled; run with --debug to generate this.</p>
|
|
388
|
+
|
|
389
|
+
</div>
|
|
390
|
+
|
|
391
|
+
<div id="validator-badges">
|
|
392
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
393
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
|
394
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
|
395
|
+
</div>
|
|
396
|
+
|
|
397
|
+
</body>
|
|
398
|
+
</html>
|
|
399
|
+
|
|
@@ -0,0 +1,481 @@
|
|
|
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::Reload</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/reload_rb.html?TB_iframe=true&height=550&width=785"
|
|
42
|
+
class="thickbox" title="lib/rconfig/reload.rb">lib/rconfig/reload.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-auto_check%3F">#auto_check?</a></li>
|
|
66
|
+
|
|
67
|
+
<li><a href="#method-i-enable_reload%3D">#enable_reload=</a></li>
|
|
68
|
+
|
|
69
|
+
<li><a href="#method-i-reload">#reload</a></li>
|
|
70
|
+
|
|
71
|
+
<li><a href="#method-i-reload%3F">#reload?</a></li>
|
|
72
|
+
|
|
73
|
+
<li><a href="#method-i-reload_disabled%3F">#reload_disabled?</a></li>
|
|
74
|
+
|
|
75
|
+
<li><a href="#method-i-reload_interval%3D">#reload_interval=</a></li>
|
|
76
|
+
|
|
77
|
+
<li><a href="#method-i-without_reload">#without_reload</a></li>
|
|
78
|
+
|
|
79
|
+
</ul>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
<!-- Included Modules -->
|
|
84
|
+
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<div id="project-metadata">
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
<div id="fileindex-section" class="section project-section">
|
|
91
|
+
<h3 class="section-header">Files</h3>
|
|
92
|
+
<ul>
|
|
93
|
+
|
|
94
|
+
<li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
|
|
95
|
+
|
|
96
|
+
</ul>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
<div id="classindex-section" class="section project-section">
|
|
101
|
+
<h3 class="section-header">Class Index
|
|
102
|
+
<span class="search-toggle"><img src="../images/find.png"
|
|
103
|
+
height="16" width="16" alt="[+]"
|
|
104
|
+
title="show/hide quicksearch" /></span></h3>
|
|
105
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
|
106
|
+
<fieldset>
|
|
107
|
+
<legend>Quicksearch</legend>
|
|
108
|
+
<input type="text" name="quicksearch" value=""
|
|
109
|
+
class="quicksearch-field" />
|
|
110
|
+
</fieldset>
|
|
111
|
+
</form>
|
|
112
|
+
|
|
113
|
+
<ul class="link-list">
|
|
114
|
+
|
|
115
|
+
<li><a href="../RConfig.html">RConfig</a></li>
|
|
116
|
+
|
|
117
|
+
<li><a href="../RConfig/Callbacks.html">RConfig::Callbacks</a></li>
|
|
118
|
+
|
|
119
|
+
<li><a href="../RConfig/Cascade.html">RConfig::Cascade</a></li>
|
|
120
|
+
|
|
121
|
+
<li><a href="../RConfig/Config.html">RConfig::Config</a></li>
|
|
122
|
+
|
|
123
|
+
<li><a href="../RConfig/ConfigError.html">RConfig::ConfigError</a></li>
|
|
124
|
+
|
|
125
|
+
<li><a href="../RConfig/Constants.html">RConfig::Constants</a></li>
|
|
126
|
+
|
|
127
|
+
<li><a href="../RConfig/CoreMethods.html">RConfig::CoreMethods</a></li>
|
|
128
|
+
|
|
129
|
+
<li><a href="../RConfig/DisabledLogger.html">RConfig::DisabledLogger</a></li>
|
|
130
|
+
|
|
131
|
+
<li><a href="../RConfig/Exceptions.html">RConfig::Exceptions</a></li>
|
|
132
|
+
|
|
133
|
+
<li><a href="../RConfig/Generators.html">RConfig::Generators</a></li>
|
|
134
|
+
|
|
135
|
+
<li><a href="../RConfig/Generators/InstallGenerator.html">RConfig::Generators::InstallGenerator</a></li>
|
|
136
|
+
|
|
137
|
+
<li><a href="../RConfig/InvalidLoadPathError.html">RConfig::InvalidLoadPathError</a></li>
|
|
138
|
+
|
|
139
|
+
<li><a href="../RConfig/LoadPaths.html">RConfig::LoadPaths</a></li>
|
|
140
|
+
|
|
141
|
+
<li><a href="../RConfig/PropertiesFile.html">RConfig::PropertiesFile</a></li>
|
|
142
|
+
|
|
143
|
+
<li><a href="../RConfig/Reload.html">RConfig::Reload</a></li>
|
|
144
|
+
|
|
145
|
+
<li><a href="../RConfig/Settings.html">RConfig::Settings</a></li>
|
|
146
|
+
|
|
147
|
+
<li><a href="../RConfig/Utils.html">RConfig::Utils</a></li>
|
|
148
|
+
|
|
149
|
+
<li><a href="../Array.html">Array</a></li>
|
|
150
|
+
|
|
151
|
+
<li><a href="../Hash.html">Hash</a></li>
|
|
152
|
+
|
|
153
|
+
<li><a href="../NilClass.html">NilClass</a></li>
|
|
154
|
+
|
|
155
|
+
<li><a href="../String.html">String</a></li>
|
|
156
|
+
|
|
157
|
+
</ul>
|
|
158
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
<div id="documentation">
|
|
166
|
+
<h1 class="module">RConfig::Reload</h1>
|
|
167
|
+
|
|
168
|
+
<div id="description">
|
|
169
|
+
|
|
170
|
+
</div>
|
|
171
|
+
|
|
172
|
+
<!-- Constants -->
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
<!-- Attributes -->
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
<!-- Methods -->
|
|
179
|
+
|
|
180
|
+
<div id="public-instance-method-details" class="method-section section">
|
|
181
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
<div id="auto-check--method" class="method-detail ">
|
|
185
|
+
<a name="method-i-auto_check%3F"></a>
|
|
186
|
+
|
|
187
|
+
<div class="method-heading">
|
|
188
|
+
|
|
189
|
+
<span class="method-name">auto_check?</span><span
|
|
190
|
+
class="method-args">(name)</span>
|
|
191
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
192
|
+
|
|
193
|
+
</div>
|
|
194
|
+
|
|
195
|
+
<div class="method-description">
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
<div class="method-source-code"
|
|
202
|
+
id="auto-check--source">
|
|
203
|
+
<pre>
|
|
204
|
+
<span class="ruby-comment cmt"># File lib/rconfig/reload.rb, line 65</span>
|
|
205
|
+
65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">auto_check?</span>(<span class="ruby-identifier">name</span>)
|
|
206
|
+
66: <span class="ruby-identifier">now</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
|
207
|
+
67: <span class="ruby-keyword kw">if</span> (<span class="ruby-operator">!</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">last_auto_check</span>[<span class="ruby-identifier">name</span>]) <span class="ruby-operator">||</span> (<span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">last_auto_check</span>[<span class="ruby-identifier">name</span>]) <span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">reload_interval</span>
|
|
208
|
+
68: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">last_auto_check</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">now</span>
|
|
209
|
+
69: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
|
210
|
+
70: <span class="ruby-keyword kw">end</span>
|
|
211
|
+
71: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
|
212
|
+
72: <span class="ruby-keyword kw">end</span></pre>
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
<div id="enable-reload--method" class="method-detail ">
|
|
224
|
+
<a name="method-i-enable_reload%3D"></a>
|
|
225
|
+
|
|
226
|
+
<div class="method-heading">
|
|
227
|
+
|
|
228
|
+
<span class="method-name">enable_reload=</span><span
|
|
229
|
+
class="method-args">(reload)</span>
|
|
230
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
231
|
+
|
|
232
|
+
</div>
|
|
233
|
+
|
|
234
|
+
<div class="method-description">
|
|
235
|
+
|
|
236
|
+
<p>
|
|
237
|
+
Sets the flag indicating whether or not reload should be executed.
|
|
238
|
+
</p>
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
<div class="method-source-code"
|
|
243
|
+
id="enable-reload--source">
|
|
244
|
+
<pre>
|
|
245
|
+
<span class="ruby-comment cmt"># File lib/rconfig/reload.rb, line 16</span>
|
|
246
|
+
16: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">enable_reload=</span>(<span class="ruby-identifier">reload</span>)
|
|
247
|
+
17: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">'Argument must be true or false.'</span> <span class="ruby-keyword kw">unless</span> [<span class="ruby-keyword kw">true</span>, <span class="ruby-keyword kw">false</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">reload</span>)
|
|
248
|
+
18: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">enable_reload</span> = <span class="ruby-identifier">reload</span>
|
|
249
|
+
19: <span class="ruby-keyword kw">end</span></pre>
|
|
250
|
+
</div>
|
|
251
|
+
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
</div>
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
<div id="reload-method" class="method-detail ">
|
|
261
|
+
<a name="method-i-reload"></a>
|
|
262
|
+
|
|
263
|
+
<div class="method-heading">
|
|
264
|
+
|
|
265
|
+
<span class="method-name">reload</span><span
|
|
266
|
+
class="method-args">(force=false)</span>
|
|
267
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
268
|
+
|
|
269
|
+
</div>
|
|
270
|
+
|
|
271
|
+
<div class="method-description">
|
|
272
|
+
|
|
273
|
+
<p>
|
|
274
|
+
Flushes cached config data, so that it can be reloaded from disk. It is
|
|
275
|
+
recommended that this should be used with caution, and any need to reload
|
|
276
|
+
in a production setting should minimized or completely avoided if possible.
|
|
277
|
+
</p>
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
<div class="method-source-code"
|
|
282
|
+
id="reload-source">
|
|
283
|
+
<pre>
|
|
284
|
+
<span class="ruby-comment cmt"># File lib/rconfig/reload.rb, line 36</span>
|
|
285
|
+
36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload</span>(<span class="ruby-identifier">force</span>=<span class="ruby-keyword kw">false</span>)
|
|
286
|
+
37: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">'Argument must be true or false.'</span> <span class="ruby-keyword kw">unless</span> [<span class="ruby-keyword kw">true</span>, <span class="ruby-keyword kw">false</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">force</span>)
|
|
287
|
+
38: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">force</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">reload?</span>
|
|
288
|
+
39: <span class="ruby-identifier">flush_cache</span>
|
|
289
|
+
40: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
|
290
|
+
41: <span class="ruby-keyword kw">end</span>
|
|
291
|
+
42: <span class="ruby-keyword kw">false</span>
|
|
292
|
+
43: <span class="ruby-keyword kw">end</span></pre>
|
|
293
|
+
</div>
|
|
294
|
+
|
|
295
|
+
</div>
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
</div>
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
<div id="reload--method" class="method-detail ">
|
|
304
|
+
<a name="method-i-reload%3F"></a>
|
|
305
|
+
|
|
306
|
+
<div class="method-heading">
|
|
307
|
+
|
|
308
|
+
<span class="method-name">reload?</span><span
|
|
309
|
+
class="method-args">()</span>
|
|
310
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
311
|
+
|
|
312
|
+
</div>
|
|
313
|
+
|
|
314
|
+
<div class="method-description">
|
|
315
|
+
|
|
316
|
+
<p>
|
|
317
|
+
Flag indicating whether or not reload should be executed.
|
|
318
|
+
</p>
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
<div class="method-source-code"
|
|
323
|
+
id="reload--source">
|
|
324
|
+
<pre>
|
|
325
|
+
<span class="ruby-comment cmt"># File lib/rconfig/reload.rb, line 6</span>
|
|
326
|
+
6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload?</span>
|
|
327
|
+
7: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">enable_reload</span>
|
|
328
|
+
8: <span class="ruby-keyword kw">end</span></pre>
|
|
329
|
+
</div>
|
|
330
|
+
|
|
331
|
+
</div>
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
</div>
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
<div id="reload-disabled--method" class="method-detail ">
|
|
340
|
+
<a name="method-i-reload_disabled%3F"></a>
|
|
341
|
+
|
|
342
|
+
<div class="method-heading">
|
|
343
|
+
|
|
344
|
+
<span class="method-name">reload_disabled?</span><span
|
|
345
|
+
class="method-args">()</span>
|
|
346
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
347
|
+
|
|
348
|
+
</div>
|
|
349
|
+
|
|
350
|
+
<div class="method-description">
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
<div class="method-source-code"
|
|
357
|
+
id="reload-disabled--source">
|
|
358
|
+
<pre>
|
|
359
|
+
<span class="ruby-comment cmt"># File lib/rconfig/reload.rb, line 10</span>
|
|
360
|
+
10: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload_disabled?</span>
|
|
361
|
+
11: <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">reload?</span>
|
|
362
|
+
12: <span class="ruby-keyword kw">end</span></pre>
|
|
363
|
+
</div>
|
|
364
|
+
|
|
365
|
+
</div>
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
</div>
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
<div id="reload-interval--method" class="method-detail ">
|
|
374
|
+
<a name="method-i-reload_interval%3D"></a>
|
|
375
|
+
|
|
376
|
+
<div class="method-heading">
|
|
377
|
+
|
|
378
|
+
<span class="method-name">reload_interval=</span><span
|
|
379
|
+
class="method-args">(interval)</span>
|
|
380
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
381
|
+
|
|
382
|
+
</div>
|
|
383
|
+
|
|
384
|
+
<div class="method-description">
|
|
385
|
+
|
|
386
|
+
<p>
|
|
387
|
+
Sets the number of seconds between reloading of config files and automatic
|
|
388
|
+
reload checks. Defaults to 5 minutes. Setting
|
|
389
|
+
</p>
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
<div class="method-source-code"
|
|
394
|
+
id="reload-interval--source">
|
|
395
|
+
<pre>
|
|
396
|
+
<span class="ruby-comment cmt"># File lib/rconfig/reload.rb, line 25</span>
|
|
397
|
+
25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload_interval=</span>(<span class="ruby-identifier">interval</span>)
|
|
398
|
+
26: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">'Argument must be Integer.'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">interval</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Integer</span>)
|
|
399
|
+
27: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">enable_reload</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">interval</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-comment cmt"># Sett</span>
|
|
400
|
+
28: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">reload_interval</span> = <span class="ruby-identifier">interval</span>
|
|
401
|
+
29: <span class="ruby-keyword kw">end</span></pre>
|
|
402
|
+
</div>
|
|
403
|
+
|
|
404
|
+
</div>
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
</div>
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
<div id="without-reload-method" class="method-detail ">
|
|
413
|
+
<a name="method-i-without_reload"></a>
|
|
414
|
+
|
|
415
|
+
<div class="method-heading">
|
|
416
|
+
|
|
417
|
+
<span class="method-name">without_reload</span><span
|
|
418
|
+
class="method-args">(&block)</span>
|
|
419
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
420
|
+
|
|
421
|
+
</div>
|
|
422
|
+
|
|
423
|
+
<div class="method-description">
|
|
424
|
+
|
|
425
|
+
<p>
|
|
426
|
+
Executes given block, without reloading any config. Meant to run
|
|
427
|
+
configuration-sensitive code that may otherwise trigger a reload of any/all
|
|
428
|
+
config files. If reload is disabled then it makes no difference if this
|
|
429
|
+
wrapper is used or not. Returns result of the block
|
|
430
|
+
</p>
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
<div class="method-source-code"
|
|
435
|
+
id="without-reload-source">
|
|
436
|
+
<pre>
|
|
437
|
+
<span class="ruby-comment cmt"># File lib/rconfig/reload.rb, line 51</span>
|
|
438
|
+
51: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">without_reload</span>(&<span class="ruby-identifier">block</span>)
|
|
439
|
+
52: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block_given?</span>
|
|
440
|
+
53: <span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">nil</span>
|
|
441
|
+
54: <span class="ruby-identifier">enable_reload_cache</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">enable_reload</span>
|
|
442
|
+
55: <span class="ruby-keyword kw">begin</span>
|
|
443
|
+
56: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">enable_reload</span>
|
|
444
|
+
57: <span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">yield</span>
|
|
445
|
+
58: <span class="ruby-keyword kw">ensure</span>
|
|
446
|
+
59: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">enable_reload</span> = <span class="ruby-identifier">enable_reload_cache</span>
|
|
447
|
+
60: <span class="ruby-identifier">check_config_changed</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">reload?</span>
|
|
448
|
+
61: <span class="ruby-keyword kw">end</span>
|
|
449
|
+
62: <span class="ruby-identifier">result</span>
|
|
450
|
+
63: <span class="ruby-keyword kw">end</span></pre>
|
|
451
|
+
</div>
|
|
452
|
+
|
|
453
|
+
</div>
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
</div>
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
</div>
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
</div>
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
|
468
|
+
|
|
469
|
+
<p>Disabled; run with --debug to generate this.</p>
|
|
470
|
+
|
|
471
|
+
</div>
|
|
472
|
+
|
|
473
|
+
<div id="validator-badges">
|
|
474
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
475
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
|
476
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
|
477
|
+
</div>
|
|
478
|
+
|
|
479
|
+
</body>
|
|
480
|
+
</html>
|
|
481
|
+
|