rconfig 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +7 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/Rakefile +11 -8
- data/doc/Array.html +184 -0
- data/doc/Hash.html +360 -0
- data/doc/NilClass.html +233 -0
- data/doc/RConfig.html +328 -0
- data/doc/RConfig/Callbacks.html +295 -0
- data/doc/RConfig/Cascade.html +316 -0
- data/doc/RConfig/Config.html +441 -0
- data/doc/RConfig/ConfigError.html +187 -0
- data/doc/RConfig/Constants.html +271 -0
- data/doc/RConfig/CoreMethods.html +814 -0
- data/doc/RConfig/DisabledLogger.html +424 -0
- data/doc/RConfig/Exceptions.html +266 -0
- data/doc/RConfig/Generators.html +186 -0
- data/doc/RConfig/Generators/InstallGenerator.html +233 -0
- data/doc/RConfig/InvalidLoadPathError.html +187 -0
- data/doc/RConfig/LoadPaths.html +375 -0
- data/doc/RConfig/Logger.html +184 -0
- data/doc/RConfig/PropertiesFile.html +399 -0
- data/doc/RConfig/Reload.html +481 -0
- data/doc/RConfig/Settings.html +188 -0
- data/doc/RConfig/Utils.html +841 -0
- data/doc/README_rdoc.html +331 -0
- data/doc/String.html +184 -0
- data/doc/created.rid +21 -1
- data/doc/index.html +423 -20
- data/doc/lib/generators/rconfig/install_generator_rb.html +52 -0
- data/doc/lib/generators/rconfig/templates/rconfig_rb.html +56 -0
- data/doc/lib/rconfig/callbacks_rb.html +52 -0
- data/doc/lib/rconfig/cascade_rb.html +52 -0
- data/doc/lib/rconfig/config_rb.html +61 -0
- data/doc/lib/rconfig/constants_rb.html +52 -0
- data/doc/lib/rconfig/core_ext/array_rb.html +52 -0
- data/doc/lib/rconfig/core_ext/hash_rb.html +61 -0
- data/doc/lib/rconfig/core_ext/nil_rb.html +52 -0
- data/doc/lib/rconfig/core_ext/string_rb.html +52 -0
- data/doc/lib/rconfig/core_methods_rb.html +55 -0
- data/doc/lib/rconfig/exceptions_rb.html +58 -0
- data/doc/lib/rconfig/load_paths_rb.html +52 -0
- data/doc/lib/rconfig/logger_rb.html +52 -0
- data/doc/lib/rconfig/properties_file_rb.html +93 -0
- data/doc/lib/rconfig/reload_rb.html +52 -0
- data/doc/lib/rconfig/settings_rb.html +52 -0
- data/doc/lib/rconfig/utils_rb.html +52 -0
- data/doc/lib/rconfig_rb.html +151 -0
- data/doc/rdoc.css +706 -0
- data/lib/rconfig.rb +1 -1
- data/lib/rconfig/load_paths.rb +2 -2
- data/lib/tasks/rdoc.rake +3 -4
- data/rconfig.gemspec +4 -2
- data/spec/config/erb_contents.yml +3 -0
- data/spec/config/props_config.conf +18 -0
- data/spec/config/spec.yml +17 -0
- data/spec/config/xml_config.xml +22 -0
- data/spec/config2/.gitkeep +0 -0
- data/spec/rconfig/load_paths_spec.rb +37 -0
- data/spec/rconfig/reload_spec.rb +37 -0
- data/spec/rconfig_spec.rb +61 -3
- data/spec/spec_helper.rb +12 -8
- metadata +82 -40
- data/doc/classes/ClassVariables.html +0 -111
- data/doc/classes/ConfigError.html +0 -120
- data/doc/classes/ConfigHash.html +0 -354
- data/doc/classes/Constants.html +0 -226
- data/doc/classes/Hash.html +0 -269
- data/doc/classes/InvalidConfigPathError.html +0 -119
- data/doc/classes/Object.html +0 -220
- data/doc/classes/PropertiesFileParser.html +0 -282
- data/doc/classes/RConfig.html +0 -1745
- data/doc/files/README_rdoc.html +0 -271
- data/doc/files/lib/rconfig/class_variables_rb.html +0 -107
- data/doc/files/lib/rconfig/config_hash_rb.html +0 -114
- data/doc/files/lib/rconfig/constants_rb.html +0 -101
- data/doc/files/lib/rconfig/core_ext/hash_rb.html +0 -114
- data/doc/files/lib/rconfig/core_ext/object_rb.html +0 -101
- data/doc/files/lib/rconfig/core_ext_rb.html +0 -114
- data/doc/files/lib/rconfig/exceptions_rb.html +0 -110
- data/doc/files/lib/rconfig/properties_file_parser_rb.html +0 -146
- data/doc/files/lib/rconfig/rconfig_rb.html +0 -186
- data/doc/files/lib/rconfig_rb.html +0 -117
- data/doc/fr_class_index.html +0 -35
- data/doc/fr_file_index.html +0 -37
- data/doc/fr_method_index.html +0 -75
- data/doc/rdoc-style.css +0 -208
- data/lib/tasks/gem.rake +0 -14
- data/lib/tasks/spec.rake +0 -25
- data/spec/core_ext/object_spec.rb +0 -44
data/ChangeLog
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -5,6 +5,7 @@ GEM
|
|
5
5
|
multi_json (~> 1.0)
|
6
6
|
diff-lcs (1.1.3)
|
7
7
|
git (1.2.5)
|
8
|
+
i18n (0.6.0)
|
8
9
|
jeweler (1.6.4)
|
9
10
|
bundler (~> 1.0)
|
10
11
|
git (>= 1.2.5)
|
@@ -26,5 +27,6 @@ PLATFORMS
|
|
26
27
|
DEPENDENCIES
|
27
28
|
activesupport (~> 3.0)
|
28
29
|
bundler (~> 1.0.0)
|
30
|
+
i18n (~> 0.6.0)
|
29
31
|
jeweler (~> 1.6.4)
|
30
32
|
rspec (~> 2.3.0)
|
data/Rakefile
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
|
3
1
|
require 'rubygems'
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
|
7
|
-
|
2
|
+
require 'bundler'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
Bundler.setup
|
6
|
+
Bundler::GemHelper.install_tasks
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new do |spec|
|
9
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
10
|
+
end
|
8
11
|
|
9
|
-
|
10
|
-
Dir['tasks/**/*.rake'].sort.each { |lib| load lib }
|
12
|
+
task :default => :spec
|
11
13
|
|
14
|
+
Dir['lib/tasks/**/*.rake'].sort.each { |lib| load lib }
|
data/doc/Array.html
ADDED
@@ -0,0 +1,184 @@
|
|
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: Array</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/core_ext/array_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
+
class="thickbox" title="lib/rconfig/core_ext/array.rb">lib/rconfig/core_ext/array.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
|
+
|
69
|
+
<!-- Included Modules -->
|
70
|
+
|
71
|
+
</div>
|
72
|
+
|
73
|
+
<div id="project-metadata">
|
74
|
+
|
75
|
+
|
76
|
+
<div id="fileindex-section" class="section project-section">
|
77
|
+
<h3 class="section-header">Files</h3>
|
78
|
+
<ul>
|
79
|
+
|
80
|
+
<li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
|
81
|
+
|
82
|
+
</ul>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
|
86
|
+
<div id="classindex-section" class="section project-section">
|
87
|
+
<h3 class="section-header">Class Index
|
88
|
+
<span class="search-toggle"><img src="./images/find.png"
|
89
|
+
height="16" width="16" alt="[+]"
|
90
|
+
title="show/hide quicksearch" /></span></h3>
|
91
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
92
|
+
<fieldset>
|
93
|
+
<legend>Quicksearch</legend>
|
94
|
+
<input type="text" name="quicksearch" value=""
|
95
|
+
class="quicksearch-field" />
|
96
|
+
</fieldset>
|
97
|
+
</form>
|
98
|
+
|
99
|
+
<ul class="link-list">
|
100
|
+
|
101
|
+
<li><a href="./RConfig.html">RConfig</a></li>
|
102
|
+
|
103
|
+
<li><a href="./RConfig/Callbacks.html">RConfig::Callbacks</a></li>
|
104
|
+
|
105
|
+
<li><a href="./RConfig/Cascade.html">RConfig::Cascade</a></li>
|
106
|
+
|
107
|
+
<li><a href="./RConfig/Config.html">RConfig::Config</a></li>
|
108
|
+
|
109
|
+
<li><a href="./RConfig/ConfigError.html">RConfig::ConfigError</a></li>
|
110
|
+
|
111
|
+
<li><a href="./RConfig/Constants.html">RConfig::Constants</a></li>
|
112
|
+
|
113
|
+
<li><a href="./RConfig/CoreMethods.html">RConfig::CoreMethods</a></li>
|
114
|
+
|
115
|
+
<li><a href="./RConfig/DisabledLogger.html">RConfig::DisabledLogger</a></li>
|
116
|
+
|
117
|
+
<li><a href="./RConfig/Exceptions.html">RConfig::Exceptions</a></li>
|
118
|
+
|
119
|
+
<li><a href="./RConfig/Generators.html">RConfig::Generators</a></li>
|
120
|
+
|
121
|
+
<li><a href="./RConfig/Generators/InstallGenerator.html">RConfig::Generators::InstallGenerator</a></li>
|
122
|
+
|
123
|
+
<li><a href="./RConfig/InvalidLoadPathError.html">RConfig::InvalidLoadPathError</a></li>
|
124
|
+
|
125
|
+
<li><a href="./RConfig/LoadPaths.html">RConfig::LoadPaths</a></li>
|
126
|
+
|
127
|
+
<li><a href="./RConfig/PropertiesFile.html">RConfig::PropertiesFile</a></li>
|
128
|
+
|
129
|
+
<li><a href="./RConfig/Reload.html">RConfig::Reload</a></li>
|
130
|
+
|
131
|
+
<li><a href="./RConfig/Settings.html">RConfig::Settings</a></li>
|
132
|
+
|
133
|
+
<li><a href="./RConfig/Utils.html">RConfig::Utils</a></li>
|
134
|
+
|
135
|
+
<li><a href="./Array.html">Array</a></li>
|
136
|
+
|
137
|
+
<li><a href="./Hash.html">Hash</a></li>
|
138
|
+
|
139
|
+
<li><a href="./NilClass.html">NilClass</a></li>
|
140
|
+
|
141
|
+
<li><a href="./String.html">String</a></li>
|
142
|
+
|
143
|
+
</ul>
|
144
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
</div>
|
149
|
+
</div>
|
150
|
+
|
151
|
+
<div id="documentation">
|
152
|
+
<h1 class="class">Array</h1>
|
153
|
+
|
154
|
+
<div id="description">
|
155
|
+
|
156
|
+
</div>
|
157
|
+
|
158
|
+
<!-- Constants -->
|
159
|
+
|
160
|
+
|
161
|
+
<!-- Attributes -->
|
162
|
+
|
163
|
+
|
164
|
+
<!-- Methods -->
|
165
|
+
|
166
|
+
|
167
|
+
</div>
|
168
|
+
|
169
|
+
|
170
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
171
|
+
|
172
|
+
<p>Disabled; run with --debug to generate this.</p>
|
173
|
+
|
174
|
+
</div>
|
175
|
+
|
176
|
+
<div id="validator-badges">
|
177
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
178
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
179
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
180
|
+
</div>
|
181
|
+
|
182
|
+
</body>
|
183
|
+
</html>
|
184
|
+
|
data/doc/Hash.html
ADDED
@@ -0,0 +1,360 @@
|
|
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: Hash</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/core_ext/hash_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
+
class="thickbox" title="lib/rconfig/core_ext/hash.rb">lib/rconfig/core_ext/hash.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-i-weave">#weave</a></li>
|
73
|
+
|
74
|
+
<li><a href="#method-i-weave%21">#weave!</a></li>
|
75
|
+
|
76
|
+
</ul>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
|
80
|
+
<!-- Included Modules -->
|
81
|
+
|
82
|
+
</div>
|
83
|
+
|
84
|
+
<div id="project-metadata">
|
85
|
+
|
86
|
+
|
87
|
+
<div id="fileindex-section" class="section project-section">
|
88
|
+
<h3 class="section-header">Files</h3>
|
89
|
+
<ul>
|
90
|
+
|
91
|
+
<li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
|
92
|
+
|
93
|
+
</ul>
|
94
|
+
</div>
|
95
|
+
|
96
|
+
|
97
|
+
<div id="classindex-section" class="section project-section">
|
98
|
+
<h3 class="section-header">Class Index
|
99
|
+
<span class="search-toggle"><img src="./images/find.png"
|
100
|
+
height="16" width="16" alt="[+]"
|
101
|
+
title="show/hide quicksearch" /></span></h3>
|
102
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
103
|
+
<fieldset>
|
104
|
+
<legend>Quicksearch</legend>
|
105
|
+
<input type="text" name="quicksearch" value=""
|
106
|
+
class="quicksearch-field" />
|
107
|
+
</fieldset>
|
108
|
+
</form>
|
109
|
+
|
110
|
+
<ul class="link-list">
|
111
|
+
|
112
|
+
<li><a href="./RConfig.html">RConfig</a></li>
|
113
|
+
|
114
|
+
<li><a href="./RConfig/Callbacks.html">RConfig::Callbacks</a></li>
|
115
|
+
|
116
|
+
<li><a href="./RConfig/Cascade.html">RConfig::Cascade</a></li>
|
117
|
+
|
118
|
+
<li><a href="./RConfig/Config.html">RConfig::Config</a></li>
|
119
|
+
|
120
|
+
<li><a href="./RConfig/ConfigError.html">RConfig::ConfigError</a></li>
|
121
|
+
|
122
|
+
<li><a href="./RConfig/Constants.html">RConfig::Constants</a></li>
|
123
|
+
|
124
|
+
<li><a href="./RConfig/CoreMethods.html">RConfig::CoreMethods</a></li>
|
125
|
+
|
126
|
+
<li><a href="./RConfig/DisabledLogger.html">RConfig::DisabledLogger</a></li>
|
127
|
+
|
128
|
+
<li><a href="./RConfig/Exceptions.html">RConfig::Exceptions</a></li>
|
129
|
+
|
130
|
+
<li><a href="./RConfig/Generators.html">RConfig::Generators</a></li>
|
131
|
+
|
132
|
+
<li><a href="./RConfig/Generators/InstallGenerator.html">RConfig::Generators::InstallGenerator</a></li>
|
133
|
+
|
134
|
+
<li><a href="./RConfig/InvalidLoadPathError.html">RConfig::InvalidLoadPathError</a></li>
|
135
|
+
|
136
|
+
<li><a href="./RConfig/LoadPaths.html">RConfig::LoadPaths</a></li>
|
137
|
+
|
138
|
+
<li><a href="./RConfig/PropertiesFile.html">RConfig::PropertiesFile</a></li>
|
139
|
+
|
140
|
+
<li><a href="./RConfig/Reload.html">RConfig::Reload</a></li>
|
141
|
+
|
142
|
+
<li><a href="./RConfig/Settings.html">RConfig::Settings</a></li>
|
143
|
+
|
144
|
+
<li><a href="./RConfig/Utils.html">RConfig::Utils</a></li>
|
145
|
+
|
146
|
+
<li><a href="./Array.html">Array</a></li>
|
147
|
+
|
148
|
+
<li><a href="./Hash.html">Hash</a></li>
|
149
|
+
|
150
|
+
<li><a href="./NilClass.html">NilClass</a></li>
|
151
|
+
|
152
|
+
<li><a href="./String.html">String</a></li>
|
153
|
+
|
154
|
+
</ul>
|
155
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
|
159
|
+
</div>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
<div id="documentation">
|
163
|
+
<h1 class="class">Hash</h1>
|
164
|
+
|
165
|
+
<div id="description">
|
166
|
+
<p>
|
167
|
+
source: <a
|
168
|
+
href="http://rubyforge.org/projects/facets/">rubyforge.org/projects/facets/</a>
|
169
|
+
version: 1.7.46 license: Ruby License NOTE: remove this method if the
|
170
|
+
Facets gem is installed. BUG: weave is destructive to values in the source
|
171
|
+
hash that are arrays!
|
172
|
+
</p>
|
173
|
+
<pre>
|
174
|
+
(this is acceptable for RConfig's use as the basis for weave!)</pre>
|
175
|
+
|
176
|
+
</div>
|
177
|
+
|
178
|
+
<!-- Constants -->
|
179
|
+
|
180
|
+
|
181
|
+
<!-- Attributes -->
|
182
|
+
|
183
|
+
|
184
|
+
<!-- Methods -->
|
185
|
+
|
186
|
+
<div id="public-instance-method-details" class="method-section section">
|
187
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
188
|
+
|
189
|
+
|
190
|
+
<div id="weave-method" class="method-detail ">
|
191
|
+
<a name="method-i-weave"></a>
|
192
|
+
|
193
|
+
<div class="method-heading">
|
194
|
+
|
195
|
+
<span class="method-name">weave</span><span
|
196
|
+
class="method-args">(other_hash, clobber=false)</span>
|
197
|
+
<span class="method-click-advice">click to toggle source</span>
|
198
|
+
|
199
|
+
</div>
|
200
|
+
|
201
|
+
<div class="method-description">
|
202
|
+
|
203
|
+
<p>
|
204
|
+
Weaves the contents of two hashes producing a new hash.
|
205
|
+
</p>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
<div class="method-source-code"
|
210
|
+
id="weave-source">
|
211
|
+
<pre>
|
212
|
+
<span class="ruby-comment cmt"># File lib/rconfig/core_ext/hash.rb, line 14</span>
|
213
|
+
14: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">weave</span>(<span class="ruby-identifier">other_hash</span>, <span class="ruby-identifier">clobber</span>=<span class="ruby-keyword kw">false</span>)
|
214
|
+
15: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">other_hash</span>
|
215
|
+
16: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">other_hash</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Hash</span>)
|
216
|
+
17: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"RConfig: (Hash#weave) expected <Hash>, but was <#{other_hash.class}>"</span>
|
217
|
+
18: <span class="ruby-keyword kw">end</span>
|
218
|
+
19:
|
219
|
+
20: <span class="ruby-identifier">self_dup</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># self.clone does not remove freeze!</span>
|
220
|
+
21:
|
221
|
+
22: <span class="ruby-identifier">other_hash</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">other_node</span><span class="ruby-operator">|</span>
|
222
|
+
23:
|
223
|
+
24: <span class="ruby-identifier">self_dup</span>[<span class="ruby-identifier">key</span>] =
|
224
|
+
25:
|
225
|
+
26: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">self_node</span> = <span class="ruby-identifier">self_dup</span>[<span class="ruby-identifier">key</span>]
|
226
|
+
27:
|
227
|
+
28: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">self_node</span>
|
228
|
+
29: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Hash</span>
|
229
|
+
30:
|
230
|
+
31: <span class="ruby-comment cmt"># hash1, hash2 => hash3 (recursive +)</span>
|
231
|
+
32: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other_node</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
|
232
|
+
33:
|
233
|
+
34: <span class="ruby-identifier">self_node</span>.<span class="ruby-identifier">weave</span>(<span class="ruby-identifier">other_node</span>, <span class="ruby-identifier">clobber</span>)
|
234
|
+
35:
|
235
|
+
36: <span class="ruby-comment cmt"># hash, array => error (Can't weave'em, must clobber.)</span>
|
236
|
+
37: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">other_node</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">clobber</span>
|
237
|
+
38:
|
238
|
+
39: <span class="ruby-identifier">raise</span>(<span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"RConfig: (Hash#weave) Can't weave Hash and Array"</span>)
|
239
|
+
40:
|
240
|
+
41: <span class="ruby-comment cmt"># hash, array => hash[key] = array</span>
|
241
|
+
42: <span class="ruby-comment cmt"># hash, value => hash[key] = value</span>
|
242
|
+
43: <span class="ruby-keyword kw">else</span>
|
243
|
+
44: <span class="ruby-identifier">other_node</span>
|
244
|
+
45: <span class="ruby-keyword kw">end</span>
|
245
|
+
46:
|
246
|
+
47: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Array</span>
|
247
|
+
48:
|
248
|
+
49: <span class="ruby-comment cmt"># array, hash => array << hash</span>
|
249
|
+
50: <span class="ruby-comment cmt"># array1, array2 => array1 + array2</span>
|
250
|
+
51: <span class="ruby-comment cmt"># array, value => array << value</span>
|
251
|
+
52: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">clobber</span>
|
252
|
+
53: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">other_node</span>
|
253
|
+
54: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Hash</span>
|
254
|
+
55: <span class="ruby-identifier">self_node</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">other_node</span>
|
255
|
+
56: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Array</span>
|
256
|
+
57: <span class="ruby-identifier">self_node</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">other_node</span>
|
257
|
+
58: <span class="ruby-keyword kw">else</span>
|
258
|
+
59: <span class="ruby-identifier">self_node</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">other_node</span>
|
259
|
+
60: <span class="ruby-keyword kw">end</span>
|
260
|
+
61:
|
261
|
+
62: <span class="ruby-comment cmt"># array, hash => hash</span>
|
262
|
+
63: <span class="ruby-comment cmt"># array1, array2 => array2</span>
|
263
|
+
64: <span class="ruby-comment cmt"># array, value => value</span>
|
264
|
+
65: <span class="ruby-keyword kw">else</span>
|
265
|
+
66: <span class="ruby-identifier">other_node</span>
|
266
|
+
67: <span class="ruby-keyword kw">end</span>
|
267
|
+
68:
|
268
|
+
69: <span class="ruby-keyword kw">else</span>
|
269
|
+
70:
|
270
|
+
71: <span class="ruby-comment cmt"># value, array => array.unshift(value)</span>
|
271
|
+
72: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other_node</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">clobber</span>
|
272
|
+
73: <span class="ruby-identifier">other_node</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">self_node</span>)
|
273
|
+
74:
|
274
|
+
75: <span class="ruby-comment cmt"># value1, value2 => value2</span>
|
275
|
+
76: <span class="ruby-keyword kw">else</span>
|
276
|
+
77: <span class="ruby-identifier">other_node</span>
|
277
|
+
78: <span class="ruby-keyword kw">end</span>
|
278
|
+
79:
|
279
|
+
80: <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># case self_node</span>
|
280
|
+
81:
|
281
|
+
82: <span class="ruby-comment cmt"># Target hash didn't have a node matching the key,</span>
|
282
|
+
83: <span class="ruby-comment cmt"># so just add it from the source hash.</span>
|
283
|
+
84: <span class="ruby-comment cmt"># !self_dup.has_key?(key) => self_dup.add(key, other_node)</span>
|
284
|
+
85: <span class="ruby-keyword kw">else</span>
|
285
|
+
86: <span class="ruby-identifier">other_node</span>
|
286
|
+
87: <span class="ruby-keyword kw">end</span>
|
287
|
+
88:
|
288
|
+
89: } <span class="ruby-comment cmt"># other_hash.each</span>
|
289
|
+
90:
|
290
|
+
91: <span class="ruby-identifier">self_dup</span> <span class="ruby-comment cmt"># return new weaved hash</span>
|
291
|
+
92: <span class="ruby-keyword kw">end</span></pre>
|
292
|
+
</div>
|
293
|
+
|
294
|
+
</div>
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
</div>
|
300
|
+
|
301
|
+
|
302
|
+
<div id="weave--method" class="method-detail ">
|
303
|
+
<a name="method-i-weave%21"></a>
|
304
|
+
|
305
|
+
<div class="method-heading">
|
306
|
+
|
307
|
+
<span class="method-name">weave!</span><span
|
308
|
+
class="method-args">(other_hash, clobber=false)</span>
|
309
|
+
<span class="method-click-advice">click to toggle source</span>
|
310
|
+
|
311
|
+
</div>
|
312
|
+
|
313
|
+
<div class="method-description">
|
314
|
+
|
315
|
+
<p>
|
316
|
+
Same as self.weave(other_hash, dont_clobber) except that it weaves other
|
317
|
+
hash to itself, rather than create a new hash.
|
318
|
+
</p>
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
<div class="method-source-code"
|
323
|
+
id="weave--source">
|
324
|
+
<pre>
|
325
|
+
<span class="ruby-comment cmt"># File lib/rconfig/core_ext/hash.rb, line 97</span>
|
326
|
+
97: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">weave!</span>(<span class="ruby-identifier">other_hash</span>, <span class="ruby-identifier">clobber</span>=<span class="ruby-keyword kw">false</span>)
|
327
|
+
98: <span class="ruby-identifier">weaved_hash</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">weave</span>(<span class="ruby-identifier">other_hash</span>, <span class="ruby-identifier">clobber</span>)
|
328
|
+
99: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">weaved_hash</span>)
|
329
|
+
100: <span class="ruby-keyword kw">end</span></pre>
|
330
|
+
</div>
|
331
|
+
|
332
|
+
</div>
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
</div>
|
338
|
+
|
339
|
+
|
340
|
+
</div>
|
341
|
+
|
342
|
+
|
343
|
+
</div>
|
344
|
+
|
345
|
+
|
346
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
347
|
+
|
348
|
+
<p>Disabled; run with --debug to generate this.</p>
|
349
|
+
|
350
|
+
</div>
|
351
|
+
|
352
|
+
<div id="validator-badges">
|
353
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
354
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
355
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
356
|
+
</div>
|
357
|
+
|
358
|
+
</body>
|
359
|
+
</html>
|
360
|
+
|