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,188 @@
|
|
|
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::Settings</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/settings_rb.html?TB_iframe=true&height=550&width=785"
|
|
42
|
+
class="thickbox" title="lib/rconfig/settings.rb">lib/rconfig/settings.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
|
+
|
|
62
|
+
<!-- Included Modules -->
|
|
63
|
+
|
|
64
|
+
<div id="includes-section" class="section">
|
|
65
|
+
<h3 class="section-header">Included Modules</h3>
|
|
66
|
+
<ul class="link-list">
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
<li><span class="include">Constants</span></li>
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
</ul>
|
|
73
|
+
</div>
|
|
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::Settings</h1>
|
|
157
|
+
|
|
158
|
+
<div id="description">
|
|
159
|
+
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<!-- Constants -->
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
<!-- Attributes -->
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
<!-- Methods -->
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
|
175
|
+
|
|
176
|
+
<p>Disabled; run with --debug to generate this.</p>
|
|
177
|
+
|
|
178
|
+
</div>
|
|
179
|
+
|
|
180
|
+
<div id="validator-badges">
|
|
181
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
182
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
|
183
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
</body>
|
|
187
|
+
</html>
|
|
188
|
+
|
|
@@ -0,0 +1,841 @@
|
|
|
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::Utils</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/utils_rb.html?TB_iframe=true&height=550&width=785"
|
|
42
|
+
class="thickbox" title="lib/rconfig/utils.rb">lib/rconfig/utils.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-app_root">#app_root</a></li>
|
|
66
|
+
|
|
67
|
+
<li><a href="#method-i-create_dottable_hash">#create_dottable_hash</a></li>
|
|
68
|
+
|
|
69
|
+
<li><a href="#method-i-default_load_paths">#default_load_paths</a></li>
|
|
70
|
+
|
|
71
|
+
<li><a href="#method-i-filename_for_name">#filename_for_name</a></li>
|
|
72
|
+
|
|
73
|
+
<li><a href="#method-i-flush_cache">#flush_cache</a></li>
|
|
74
|
+
|
|
75
|
+
<li><a href="#method-i-log_level">#log_level</a></li>
|
|
76
|
+
|
|
77
|
+
<li><a href="#method-i-log_level%3D">#log_level=</a></li>
|
|
78
|
+
|
|
79
|
+
<li><a href="#method-i-make_indifferent">#make_indifferent</a></li>
|
|
80
|
+
|
|
81
|
+
<li><a href="#method-i-merge_hashes">#merge_hashes</a></li>
|
|
82
|
+
|
|
83
|
+
<li><a href="#method-i-parse">#parse</a></li>
|
|
84
|
+
|
|
85
|
+
<li><a href="#method-i-parse_xml">#parse_xml</a></li>
|
|
86
|
+
|
|
87
|
+
<li><a href="#method-i-rails%3F">#rails?</a></li>
|
|
88
|
+
|
|
89
|
+
<li><a href="#method-i-read">#read</a></li>
|
|
90
|
+
|
|
91
|
+
<li><a href="#method-i-setting">#setting</a></li>
|
|
92
|
+
|
|
93
|
+
<li><a href="#method-i-setup">#setup</a></li>
|
|
94
|
+
|
|
95
|
+
</ul>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
<!-- Included Modules -->
|
|
100
|
+
|
|
101
|
+
<div id="includes-section" class="section">
|
|
102
|
+
<h3 class="section-header">Included Modules</h3>
|
|
103
|
+
<ul class="link-list">
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
<li><span class="include">Constants</span></li>
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
</ul>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<div id="project-metadata">
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
<div id="fileindex-section" class="section project-section">
|
|
118
|
+
<h3 class="section-header">Files</h3>
|
|
119
|
+
<ul>
|
|
120
|
+
|
|
121
|
+
<li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
|
|
122
|
+
|
|
123
|
+
</ul>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
<div id="classindex-section" class="section project-section">
|
|
128
|
+
<h3 class="section-header">Class Index
|
|
129
|
+
<span class="search-toggle"><img src="../images/find.png"
|
|
130
|
+
height="16" width="16" alt="[+]"
|
|
131
|
+
title="show/hide quicksearch" /></span></h3>
|
|
132
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
|
133
|
+
<fieldset>
|
|
134
|
+
<legend>Quicksearch</legend>
|
|
135
|
+
<input type="text" name="quicksearch" value=""
|
|
136
|
+
class="quicksearch-field" />
|
|
137
|
+
</fieldset>
|
|
138
|
+
</form>
|
|
139
|
+
|
|
140
|
+
<ul class="link-list">
|
|
141
|
+
|
|
142
|
+
<li><a href="../RConfig.html">RConfig</a></li>
|
|
143
|
+
|
|
144
|
+
<li><a href="../RConfig/Callbacks.html">RConfig::Callbacks</a></li>
|
|
145
|
+
|
|
146
|
+
<li><a href="../RConfig/Cascade.html">RConfig::Cascade</a></li>
|
|
147
|
+
|
|
148
|
+
<li><a href="../RConfig/Config.html">RConfig::Config</a></li>
|
|
149
|
+
|
|
150
|
+
<li><a href="../RConfig/ConfigError.html">RConfig::ConfigError</a></li>
|
|
151
|
+
|
|
152
|
+
<li><a href="../RConfig/Constants.html">RConfig::Constants</a></li>
|
|
153
|
+
|
|
154
|
+
<li><a href="../RConfig/CoreMethods.html">RConfig::CoreMethods</a></li>
|
|
155
|
+
|
|
156
|
+
<li><a href="../RConfig/DisabledLogger.html">RConfig::DisabledLogger</a></li>
|
|
157
|
+
|
|
158
|
+
<li><a href="../RConfig/Exceptions.html">RConfig::Exceptions</a></li>
|
|
159
|
+
|
|
160
|
+
<li><a href="../RConfig/Generators.html">RConfig::Generators</a></li>
|
|
161
|
+
|
|
162
|
+
<li><a href="../RConfig/Generators/InstallGenerator.html">RConfig::Generators::InstallGenerator</a></li>
|
|
163
|
+
|
|
164
|
+
<li><a href="../RConfig/InvalidLoadPathError.html">RConfig::InvalidLoadPathError</a></li>
|
|
165
|
+
|
|
166
|
+
<li><a href="../RConfig/LoadPaths.html">RConfig::LoadPaths</a></li>
|
|
167
|
+
|
|
168
|
+
<li><a href="../RConfig/PropertiesFile.html">RConfig::PropertiesFile</a></li>
|
|
169
|
+
|
|
170
|
+
<li><a href="../RConfig/Reload.html">RConfig::Reload</a></li>
|
|
171
|
+
|
|
172
|
+
<li><a href="../RConfig/Settings.html">RConfig::Settings</a></li>
|
|
173
|
+
|
|
174
|
+
<li><a href="../RConfig/Utils.html">RConfig::Utils</a></li>
|
|
175
|
+
|
|
176
|
+
<li><a href="../Array.html">Array</a></li>
|
|
177
|
+
|
|
178
|
+
<li><a href="../Hash.html">Hash</a></li>
|
|
179
|
+
|
|
180
|
+
<li><a href="../NilClass.html">NilClass</a></li>
|
|
181
|
+
|
|
182
|
+
<li><a href="../String.html">String</a></li>
|
|
183
|
+
|
|
184
|
+
</ul>
|
|
185
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
<div id="documentation">
|
|
193
|
+
<h1 class="module">RConfig::Utils</h1>
|
|
194
|
+
|
|
195
|
+
<div id="description">
|
|
196
|
+
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<!-- Constants -->
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
<!-- Attributes -->
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
<!-- Methods -->
|
|
206
|
+
|
|
207
|
+
<div id="public-instance-method-details" class="method-section section">
|
|
208
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
<div id="app-root-method" class="method-detail ">
|
|
212
|
+
<a name="method-i-app_root"></a>
|
|
213
|
+
|
|
214
|
+
<div class="method-heading">
|
|
215
|
+
|
|
216
|
+
<span class="method-name">app_root</span><span
|
|
217
|
+
class="method-args">()</span>
|
|
218
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
219
|
+
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
<div class="method-description">
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
<div class="method-source-code"
|
|
229
|
+
id="app-root-source">
|
|
230
|
+
<pre>
|
|
231
|
+
<span class="ruby-comment cmt"># File lib/rconfig/utils.rb, line 53</span>
|
|
232
|
+
53: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">app_root</span>
|
|
233
|
+
54: <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>))
|
|
234
|
+
55: <span class="ruby-keyword kw">end</span></pre>
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
</div>
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
</div>
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
<div id="create-dottable-hash-method" class="method-detail ">
|
|
246
|
+
<a name="method-i-create_dottable_hash"></a>
|
|
247
|
+
|
|
248
|
+
<div class="method-heading">
|
|
249
|
+
|
|
250
|
+
<span class="method-name">create_dottable_hash</span><span
|
|
251
|
+
class="method-args">(hash)</span>
|
|
252
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
253
|
+
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
<div class="method-description">
|
|
257
|
+
|
|
258
|
+
<p>
|
|
259
|
+
Creates a dottable hash for all <a href="../Hash.html">Hash</a> objects,
|
|
260
|
+
recursively.
|
|
261
|
+
</p>
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
<div class="method-source-code"
|
|
266
|
+
id="create-dottable-hash-source">
|
|
267
|
+
<pre>
|
|
268
|
+
<span class="ruby-comment cmt"># File lib/rconfig/utils.rb, line 72</span>
|
|
269
|
+
72: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_dottable_hash</span>(<span class="ruby-identifier">hash</span>)
|
|
270
|
+
73: <span class="ruby-identifier">make_indifferent</span>(<span class="ruby-identifier">hash</span>)
|
|
271
|
+
74: <span class="ruby-keyword kw">end</span></pre>
|
|
272
|
+
</div>
|
|
273
|
+
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
</div>
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
<div id="default-load-paths-method" class="method-detail ">
|
|
283
|
+
<a name="method-i-default_load_paths"></a>
|
|
284
|
+
|
|
285
|
+
<div class="method-heading">
|
|
286
|
+
|
|
287
|
+
<span class="method-name">default_load_paths</span><span
|
|
288
|
+
class="method-args">()</span>
|
|
289
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
290
|
+
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
<div class="method-description">
|
|
294
|
+
|
|
295
|
+
<p>
|
|
296
|
+
Checks environment for default configuration load paths. Adds them to load
|
|
297
|
+
paths if found.
|
|
298
|
+
</p>
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
<div class="method-source-code"
|
|
303
|
+
id="default-load-paths-source">
|
|
304
|
+
<pre>
|
|
305
|
+
<span class="ruby-comment cmt"># File lib/rconfig/utils.rb, line 28</span>
|
|
306
|
+
28: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default_load_paths</span>
|
|
307
|
+
29: <span class="ruby-identifier">paths</span> = []
|
|
308
|
+
30:
|
|
309
|
+
31: <span class="ruby-comment cmt"># Check for Rails config path</span>
|
|
310
|
+
32: <span class="ruby-identifier">paths</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{::Rails.root}/config"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rails?</span>
|
|
311
|
+
33:
|
|
312
|
+
34: <span class="ruby-comment cmt"># Check for defined constants</span>
|
|
313
|
+
35: <span class="ruby-identifier">paths</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">CONFIG_ROOT</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">CONFIG_ROOT</span>) <span class="ruby-operator">&&</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-constant">CONFIG_ROOT</span>)
|
|
314
|
+
36: <span class="ruby-identifier">paths</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">CONFIG_PATH</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">CONFIG_PATH</span>) <span class="ruby-operator">&&</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-constant">CONFIG_PATH</span>)
|
|
315
|
+
37:
|
|
316
|
+
38: <span class="ruby-comment cmt"># Check for config directory in app root</span>
|
|
317
|
+
39: <span class="ruby-identifier">config_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">app_root</span>, <span class="ruby-value str">'config'</span>)
|
|
318
|
+
40: <span class="ruby-identifier">paths</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">config_dir</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">config_dir</span>)
|
|
319
|
+
41:
|
|
320
|
+
42: <span class="ruby-identifier">paths</span>
|
|
321
|
+
43: <span class="ruby-keyword kw">end</span></pre>
|
|
322
|
+
</div>
|
|
323
|
+
|
|
324
|
+
</div>
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
</div>
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
<div id="filename-for-name-method" class="method-detail ">
|
|
333
|
+
<a name="method-i-filename_for_name"></a>
|
|
334
|
+
|
|
335
|
+
<div class="method-heading">
|
|
336
|
+
|
|
337
|
+
<span class="method-name">filename_for_name</span><span
|
|
338
|
+
class="method-args">(name, directory=self.load_paths.first, ext=:yml)</span>
|
|
339
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
340
|
+
|
|
341
|
+
</div>
|
|
342
|
+
|
|
343
|
+
<div class="method-description">
|
|
344
|
+
|
|
345
|
+
<p>
|
|
346
|
+
Get complete file name, including file path for the given config name and
|
|
347
|
+
directory.
|
|
348
|
+
</p>
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
<div class="method-source-code"
|
|
353
|
+
id="filename-for-name-source">
|
|
354
|
+
<pre>
|
|
355
|
+
<span class="ruby-comment cmt"># File lib/rconfig/utils.rb, line 168</span>
|
|
356
|
+
168: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">filename_for_name</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">directory</span>=<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">load_paths</span>.<span class="ruby-identifier">first</span>, <span class="ruby-identifier">ext</span>=<span class="ruby-value">:yml</span>)
|
|
357
|
+
169: <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">directory</span>, <span class="ruby-node">"#{name}.#{ext}"</span>)
|
|
358
|
+
170: <span class="ruby-keyword kw">end</span></pre>
|
|
359
|
+
</div>
|
|
360
|
+
|
|
361
|
+
</div>
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
</div>
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
<div id="flush-cache-method" class="method-detail ">
|
|
370
|
+
<a name="method-i-flush_cache"></a>
|
|
371
|
+
|
|
372
|
+
<div class="method-heading">
|
|
373
|
+
|
|
374
|
+
<span class="method-name">flush_cache</span><span
|
|
375
|
+
class="method-args">(name=nil)</span>
|
|
376
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
377
|
+
|
|
378
|
+
</div>
|
|
379
|
+
|
|
380
|
+
<div class="method-description">
|
|
381
|
+
|
|
382
|
+
<p>
|
|
383
|
+
If a config file name is specified, flushes cached config values for
|
|
384
|
+
specified config file. Otherwise, flushes all cached config data. The
|
|
385
|
+
latter should be avoided in production environments, if possible.
|
|
386
|
+
</p>
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
<div class="method-source-code"
|
|
391
|
+
id="flush-cache-source">
|
|
392
|
+
<pre>
|
|
393
|
+
<span class="ruby-comment cmt"># File lib/rconfig/utils.rb, line 150</span>
|
|
394
|
+
150: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">flush_cache</span>(<span class="ruby-identifier">name</span>=<span class="ruby-keyword kw">nil</span>)
|
|
395
|
+
151: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name</span>
|
|
396
|
+
152: <span class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>
|
|
397
|
+
153: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cache_hash</span>[<span class="ruby-identifier">name</span>] <span class="ruby-operator">&&=</span> <span class="ruby-keyword kw">nil</span>
|
|
398
|
+
154: <span class="ruby-keyword kw">else</span>
|
|
399
|
+
155: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">warn</span> <span class="ruby-value str">"RConfig: Flushing config data cache."</span>
|
|
400
|
+
156: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">suffixes</span> = {}
|
|
401
|
+
157: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cache</span> = {}
|
|
402
|
+
158: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cache_files</span> = {}
|
|
403
|
+
159: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cache_hash</span> = {}
|
|
404
|
+
160: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">last_auto_check</span> = {}
|
|
405
|
+
161: <span class="ruby-keyword kw">self</span>
|
|
406
|
+
162: <span class="ruby-keyword kw">end</span>
|
|
407
|
+
163: <span class="ruby-keyword kw">end</span></pre>
|
|
408
|
+
</div>
|
|
409
|
+
|
|
410
|
+
</div>
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
</div>
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
<div id="log-level-method" class="method-detail ">
|
|
419
|
+
<a name="method-i-log_level"></a>
|
|
420
|
+
|
|
421
|
+
<div class="method-heading">
|
|
422
|
+
|
|
423
|
+
<span class="method-name">log_level</span><span
|
|
424
|
+
class="method-args">()</span>
|
|
425
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
426
|
+
|
|
427
|
+
</div>
|
|
428
|
+
|
|
429
|
+
<div class="method-description">
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
<div class="method-source-code"
|
|
436
|
+
id="log-level-source">
|
|
437
|
+
<pre>
|
|
438
|
+
<span class="ruby-comment cmt"># File lib/rconfig/utils.rb, line 66</span>
|
|
439
|
+
66: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log_level</span>
|
|
440
|
+
67: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">try</span>(<span class="ruby-value">:level</span>)
|
|
441
|
+
68: <span class="ruby-keyword kw">end</span></pre>
|
|
442
|
+
</div>
|
|
443
|
+
|
|
444
|
+
</div>
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
</div>
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
<div id="log-level--method" class="method-detail ">
|
|
453
|
+
<a name="method-i-log_level%3D"></a>
|
|
454
|
+
|
|
455
|
+
<div class="method-heading">
|
|
456
|
+
|
|
457
|
+
<span class="method-name">log_level=</span><span
|
|
458
|
+
class="method-args">(level)</span>
|
|
459
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
460
|
+
|
|
461
|
+
</div>
|
|
462
|
+
|
|
463
|
+
<div class="method-description">
|
|
464
|
+
|
|
465
|
+
<p>
|
|
466
|
+
Helper method for white-box testing and debugging. Sets the flag indicating
|
|
467
|
+
whether or not to log errors and application run-time information.
|
|
468
|
+
</p>
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
<div class="method-source-code"
|
|
473
|
+
id="log-level--source">
|
|
474
|
+
<pre>
|
|
475
|
+
<span class="ruby-comment cmt"># File lib/rconfig/utils.rb, line 61</span>
|
|
476
|
+
61: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log_level=</span>(<span class="ruby-identifier">level</span>)
|
|
477
|
+
62: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">logger</span>
|
|
478
|
+
63: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">level</span> = <span class="ruby-identifier">level</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">level</span>.<span class="ruby-identifier">nil?</span>
|
|
479
|
+
64: <span class="ruby-keyword kw">end</span></pre>
|
|
480
|
+
</div>
|
|
481
|
+
|
|
482
|
+
</div>
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
</div>
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
<div id="make-indifferent-method" class="method-detail ">
|
|
491
|
+
<a name="method-i-make_indifferent"></a>
|
|
492
|
+
|
|
493
|
+
<div class="method-heading">
|
|
494
|
+
|
|
495
|
+
<span class="method-name">make_indifferent</span><span
|
|
496
|
+
class="method-args">(hash)</span>
|
|
497
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
498
|
+
|
|
499
|
+
</div>
|
|
500
|
+
|
|
501
|
+
<div class="method-description">
|
|
502
|
+
|
|
503
|
+
<p>
|
|
504
|
+
Recursively makes hashes into frozen IndifferentAccess <a
|
|
505
|
+
href="Config.html">Config</a> <a href="../Hash.html">Hash</a> Arrays are
|
|
506
|
+
also traversed and frozen.
|
|
507
|
+
</p>
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
<div class="method-source-code"
|
|
512
|
+
id="make-indifferent-source">
|
|
513
|
+
<pre>
|
|
514
|
+
<span class="ruby-comment cmt"># File lib/rconfig/utils.rb, line 122</span>
|
|
515
|
+
122: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">make_indifferent</span>(<span class="ruby-identifier">hash</span>)
|
|
516
|
+
123: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">hash</span>
|
|
517
|
+
124: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Hash</span>
|
|
518
|
+
125: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">frozen?</span>
|
|
519
|
+
126: <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">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
|
520
|
+
127: <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">make_indifferent</span>(<span class="ruby-identifier">v</span>)
|
|
521
|
+
128: <span class="ruby-keyword kw">end</span>
|
|
522
|
+
129: <span class="ruby-identifier">hash</span> = <span class="ruby-constant">RConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">hash</span>).<span class="ruby-identifier">freeze</span>
|
|
523
|
+
130: <span class="ruby-keyword kw">end</span>
|
|
524
|
+
131: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">"make_indefferent: x = #{hash.inspect}:#{hash.class}"</span>
|
|
525
|
+
132: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Array</span>
|
|
526
|
+
133: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">frozen?</span>
|
|
527
|
+
134: <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">collect!</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
|
528
|
+
135: <span class="ruby-identifier">make_indifferent</span>(<span class="ruby-identifier">v</span>)
|
|
529
|
+
136: <span class="ruby-keyword kw">end</span>
|
|
530
|
+
137: <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">freeze</span>
|
|
531
|
+
138: <span class="ruby-keyword kw">end</span>
|
|
532
|
+
139: <span class="ruby-comment cmt"># Freeze Strings.</span>
|
|
533
|
+
140: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span>
|
|
534
|
+
141: <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">freeze</span>
|
|
535
|
+
142: <span class="ruby-keyword kw">end</span>
|
|
536
|
+
143: <span class="ruby-identifier">hash</span>
|
|
537
|
+
144: <span class="ruby-keyword kw">end</span></pre>
|
|
538
|
+
</div>
|
|
539
|
+
|
|
540
|
+
</div>
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
</div>
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
<div id="merge-hashes-method" class="method-detail ">
|
|
549
|
+
<a name="method-i-merge_hashes"></a>
|
|
550
|
+
|
|
551
|
+
<div class="method-heading">
|
|
552
|
+
|
|
553
|
+
<span class="method-name">merge_hashes</span><span
|
|
554
|
+
class="method-args">(hashes)</span>
|
|
555
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
556
|
+
|
|
557
|
+
</div>
|
|
558
|
+
|
|
559
|
+
<div class="method-description">
|
|
560
|
+
|
|
561
|
+
<p>
|
|
562
|
+
Returns a merge of hashes.
|
|
563
|
+
</p>
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
<div class="method-source-code"
|
|
568
|
+
id="merge-hashes-source">
|
|
569
|
+
<pre>
|
|
570
|
+
<span class="ruby-comment cmt"># File lib/rconfig/utils.rb, line 114</span>
|
|
571
|
+
114: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge_hashes</span>(<span class="ruby-identifier">hashes</span>)
|
|
572
|
+
115: <span class="ruby-identifier">hashes</span>.<span class="ruby-identifier">inject</span>({}) { <span class="ruby-operator">|</span><span class="ruby-identifier">n</span>, <span class="ruby-identifier">h</span><span class="ruby-operator">|</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">weave</span>(<span class="ruby-identifier">h</span>, <span class="ruby-keyword kw">true</span>) }
|
|
573
|
+
116: <span class="ruby-keyword kw">end</span></pre>
|
|
574
|
+
</div>
|
|
575
|
+
|
|
576
|
+
</div>
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
</div>
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
<div id="parse-method" class="method-detail ">
|
|
585
|
+
<a name="method-i-parse"></a>
|
|
586
|
+
|
|
587
|
+
<div class="method-heading">
|
|
588
|
+
|
|
589
|
+
<span class="method-name">parse</span><span
|
|
590
|
+
class="method-args">(contents, name, ext)</span>
|
|
591
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
592
|
+
|
|
593
|
+
</div>
|
|
594
|
+
|
|
595
|
+
<div class="method-description">
|
|
596
|
+
|
|
597
|
+
<p>
|
|
598
|
+
Parses contents of the config file based on file type. XML files expect the
|
|
599
|
+
root element to be the same as the file name.
|
|
600
|
+
</p>
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
<div class="method-source-code"
|
|
605
|
+
id="parse-source">
|
|
606
|
+
<pre>
|
|
607
|
+
<span class="ruby-comment cmt"># File lib/rconfig/utils.rb, line 89</span>
|
|
608
|
+
89: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">contents</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">ext</span>)
|
|
609
|
+
90: <span class="ruby-identifier">hash</span> = <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">ext</span>
|
|
610
|
+
91: <span class="ruby-keyword kw">when</span> *<span class="ruby-constant">YML_FILE_TYPES</span>
|
|
611
|
+
92: <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load</span>(<span class="ruby-identifier">contents</span>)
|
|
612
|
+
93: <span class="ruby-keyword kw">when</span> *<span class="ruby-constant">XML_FILE_TYPES</span>
|
|
613
|
+
94: <span class="ruby-identifier">parse_xml</span>(<span class="ruby-identifier">contents</span>, <span class="ruby-identifier">name</span>)
|
|
614
|
+
95: <span class="ruby-keyword kw">when</span> *<span class="ruby-constant">CNF_FILE_TYPES</span>
|
|
615
|
+
96: <span class="ruby-constant">RConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">PropertiesFile</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">contents</span>)
|
|
616
|
+
97: <span class="ruby-keyword kw">else</span>
|
|
617
|
+
98: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ConfigError</span>, <span class="ruby-node">"Unknown File type: #{ext}"</span>
|
|
618
|
+
99: <span class="ruby-keyword kw">end</span>
|
|
619
|
+
100: <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">freeze</span>
|
|
620
|
+
101: <span class="ruby-keyword kw">end</span></pre>
|
|
621
|
+
</div>
|
|
622
|
+
|
|
623
|
+
</div>
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
</div>
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
<div id="parse-xml-method" class="method-detail ">
|
|
632
|
+
<a name="method-i-parse_xml"></a>
|
|
633
|
+
|
|
634
|
+
<div class="method-heading">
|
|
635
|
+
|
|
636
|
+
<span class="method-name">parse_xml</span><span
|
|
637
|
+
class="method-args">(contents, name)</span>
|
|
638
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
639
|
+
|
|
640
|
+
</div>
|
|
641
|
+
|
|
642
|
+
<div class="method-description">
|
|
643
|
+
|
|
644
|
+
<p>
|
|
645
|
+
Parses xml file and processes any references in the property values.
|
|
646
|
+
</p>
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
<div class="method-source-code"
|
|
651
|
+
id="parse-xml-source">
|
|
652
|
+
<pre>
|
|
653
|
+
<span class="ruby-comment cmt"># File lib/rconfig/utils.rb, line 105</span>
|
|
654
|
+
105: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_xml</span>(<span class="ruby-identifier">contents</span>, <span class="ruby-identifier">name</span>)
|
|
655
|
+
106: <span class="ruby-identifier">hash</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">from_xml</span>(<span class="ruby-identifier">contents</span>)
|
|
656
|
+
107: <span class="ruby-identifier">hash</span> = <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">name</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">name</span>) <span class="ruby-comment cmt"># xml document could have root tag matching the file name.</span>
|
|
657
|
+
108: <span class="ruby-constant">RConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">PropertiesFile</span>.<span class="ruby-identifier">parse_references</span>(<span class="ruby-identifier">hash</span>)
|
|
658
|
+
109: <span class="ruby-keyword kw">end</span></pre>
|
|
659
|
+
</div>
|
|
660
|
+
|
|
661
|
+
</div>
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
</div>
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
<div id="rails--method" class="method-detail ">
|
|
670
|
+
<a name="method-i-rails%3F"></a>
|
|
671
|
+
|
|
672
|
+
<div class="method-heading">
|
|
673
|
+
|
|
674
|
+
<span class="method-name">rails?</span><span
|
|
675
|
+
class="method-args">()</span>
|
|
676
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
677
|
+
|
|
678
|
+
</div>
|
|
679
|
+
|
|
680
|
+
<div class="method-description">
|
|
681
|
+
|
|
682
|
+
<p>
|
|
683
|
+
Returns true if the current application is a rails app.
|
|
684
|
+
</p>
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
<div class="method-source-code"
|
|
689
|
+
id="rails--source">
|
|
690
|
+
<pre>
|
|
691
|
+
<span class="ruby-comment cmt"># File lib/rconfig/utils.rb, line 47</span>
|
|
692
|
+
47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rails?</span>
|
|
693
|
+
48: <span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Rails</span>)
|
|
694
|
+
49: <span class="ruby-keyword kw">end</span></pre>
|
|
695
|
+
</div>
|
|
696
|
+
|
|
697
|
+
</div>
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
</div>
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
<div id="read-method" class="method-detail ">
|
|
706
|
+
<a name="method-i-read"></a>
|
|
707
|
+
|
|
708
|
+
<div class="method-heading">
|
|
709
|
+
|
|
710
|
+
<span class="method-name">read</span><span
|
|
711
|
+
class="method-args">(file, name, ext)</span>
|
|
712
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
713
|
+
|
|
714
|
+
</div>
|
|
715
|
+
|
|
716
|
+
<div class="method-description">
|
|
717
|
+
|
|
718
|
+
<p>
|
|
719
|
+
Reads and parses the config data from the specified file.
|
|
720
|
+
</p>
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
<div class="method-source-code"
|
|
725
|
+
id="read-source">
|
|
726
|
+
<pre>
|
|
727
|
+
<span class="ruby-comment cmt"># File lib/rconfig/utils.rb, line 78</span>
|
|
728
|
+
78: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">ext</span>)
|
|
729
|
+
79: <span class="ruby-identifier">contents</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">file</span>) <span class="ruby-comment cmt"># Read the contents from the file.</span>
|
|
730
|
+
80: <span class="ruby-identifier">contents</span> = <span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">contents</span>).<span class="ruby-identifier">result</span> <span class="ruby-comment cmt"># Evaluate any ruby code using ERB.</span>
|
|
731
|
+
81: <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">contents</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">ext</span>) <span class="ruby-comment cmt"># Parse the contents based on the file type</span>
|
|
732
|
+
82: <span class="ruby-keyword kw">end</span></pre>
|
|
733
|
+
</div>
|
|
734
|
+
|
|
735
|
+
</div>
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
</div>
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
<div id="setting-method" class="method-detail ">
|
|
744
|
+
<a name="method-i-setting"></a>
|
|
745
|
+
|
|
746
|
+
<div class="method-heading">
|
|
747
|
+
|
|
748
|
+
<span class="method-name">setting</span><span
|
|
749
|
+
class="method-args">(name, default=nil)</span>
|
|
750
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
751
|
+
|
|
752
|
+
</div>
|
|
753
|
+
|
|
754
|
+
<div class="method-description">
|
|
755
|
+
|
|
756
|
+
<p>
|
|
757
|
+
Creates a class variable a sets it to the default value specified.
|
|
758
|
+
</p>
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
<div class="method-source-code"
|
|
763
|
+
id="setting-source">
|
|
764
|
+
<pre>
|
|
765
|
+
<span class="ruby-comment cmt"># File lib/rconfig/utils.rb, line 14</span>
|
|
766
|
+
14: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setting</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">default</span>=<span class="ruby-keyword kw">nil</span>)
|
|
767
|
+
15: <span class="ruby-constant">RConfig</span>.<span class="ruby-identifier">class_eval</span> <span class="ruby-value str"> def self.#{name} @@#{name} end def self.#{name}=(val) @@#{name} = val end</span>, <span class="ruby-keyword kw">__FILE__</span>, <span class="ruby-keyword kw">__LINE__</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
|
|
768
|
+
16:
|
|
769
|
+
17: <span class="ruby-constant">RConfig</span>.<span class="ruby-identifier">send</span>(<span class="ruby-value">:"#{name}="</span>, <span class="ruby-identifier">default</span>)
|
|
770
|
+
18: <span class="ruby-keyword kw">end</span></pre>
|
|
771
|
+
</div>
|
|
772
|
+
|
|
773
|
+
</div>
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
</div>
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
<div id="setup-method" class="method-detail ">
|
|
782
|
+
<a name="method-i-setup"></a>
|
|
783
|
+
|
|
784
|
+
<div class="method-heading">
|
|
785
|
+
|
|
786
|
+
<span class="method-name">setup</span><span
|
|
787
|
+
class="method-args">()</span>
|
|
788
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
789
|
+
|
|
790
|
+
</div>
|
|
791
|
+
|
|
792
|
+
<div class="method-description">
|
|
793
|
+
|
|
794
|
+
<p>
|
|
795
|
+
Used to customize configuration of <a href="../RConfig.html">RConfig</a>.
|
|
796
|
+
Run ‘rails generate rconfig:install’ to create a fresh
|
|
797
|
+
initializer with all configuration values.
|
|
798
|
+
</p>
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
<div class="method-source-code"
|
|
803
|
+
id="setup-source">
|
|
804
|
+
<pre>
|
|
805
|
+
<span class="ruby-comment cmt"># File lib/rconfig/utils.rb, line 7</span>
|
|
806
|
+
7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>
|
|
807
|
+
8: <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">self</span>
|
|
808
|
+
9: <span class="ruby-identifier">raise_load_path_error</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">load_paths</span>.<span class="ruby-identifier">empty?</span>
|
|
809
|
+
10: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">logger</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">DisabledLogger</span>.<span class="ruby-identifier">new</span>
|
|
810
|
+
11: <span class="ruby-keyword kw">end</span></pre>
|
|
811
|
+
</div>
|
|
812
|
+
|
|
813
|
+
</div>
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
</div>
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
</div>
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
</div>
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
|
828
|
+
|
|
829
|
+
<p>Disabled; run with --debug to generate this.</p>
|
|
830
|
+
|
|
831
|
+
</div>
|
|
832
|
+
|
|
833
|
+
<div id="validator-badges">
|
|
834
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
835
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
|
836
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
|
837
|
+
</div>
|
|
838
|
+
|
|
839
|
+
</body>
|
|
840
|
+
</html>
|
|
841
|
+
|