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.
Files changed (90) hide show
  1. data/ChangeLog +7 -0
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +2 -0
  4. data/Rakefile +11 -8
  5. data/doc/Array.html +184 -0
  6. data/doc/Hash.html +360 -0
  7. data/doc/NilClass.html +233 -0
  8. data/doc/RConfig.html +328 -0
  9. data/doc/RConfig/Callbacks.html +295 -0
  10. data/doc/RConfig/Cascade.html +316 -0
  11. data/doc/RConfig/Config.html +441 -0
  12. data/doc/RConfig/ConfigError.html +187 -0
  13. data/doc/RConfig/Constants.html +271 -0
  14. data/doc/RConfig/CoreMethods.html +814 -0
  15. data/doc/RConfig/DisabledLogger.html +424 -0
  16. data/doc/RConfig/Exceptions.html +266 -0
  17. data/doc/RConfig/Generators.html +186 -0
  18. data/doc/RConfig/Generators/InstallGenerator.html +233 -0
  19. data/doc/RConfig/InvalidLoadPathError.html +187 -0
  20. data/doc/RConfig/LoadPaths.html +375 -0
  21. data/doc/RConfig/Logger.html +184 -0
  22. data/doc/RConfig/PropertiesFile.html +399 -0
  23. data/doc/RConfig/Reload.html +481 -0
  24. data/doc/RConfig/Settings.html +188 -0
  25. data/doc/RConfig/Utils.html +841 -0
  26. data/doc/README_rdoc.html +331 -0
  27. data/doc/String.html +184 -0
  28. data/doc/created.rid +21 -1
  29. data/doc/index.html +423 -20
  30. data/doc/lib/generators/rconfig/install_generator_rb.html +52 -0
  31. data/doc/lib/generators/rconfig/templates/rconfig_rb.html +56 -0
  32. data/doc/lib/rconfig/callbacks_rb.html +52 -0
  33. data/doc/lib/rconfig/cascade_rb.html +52 -0
  34. data/doc/lib/rconfig/config_rb.html +61 -0
  35. data/doc/lib/rconfig/constants_rb.html +52 -0
  36. data/doc/lib/rconfig/core_ext/array_rb.html +52 -0
  37. data/doc/lib/rconfig/core_ext/hash_rb.html +61 -0
  38. data/doc/lib/rconfig/core_ext/nil_rb.html +52 -0
  39. data/doc/lib/rconfig/core_ext/string_rb.html +52 -0
  40. data/doc/lib/rconfig/core_methods_rb.html +55 -0
  41. data/doc/lib/rconfig/exceptions_rb.html +58 -0
  42. data/doc/lib/rconfig/load_paths_rb.html +52 -0
  43. data/doc/lib/rconfig/logger_rb.html +52 -0
  44. data/doc/lib/rconfig/properties_file_rb.html +93 -0
  45. data/doc/lib/rconfig/reload_rb.html +52 -0
  46. data/doc/lib/rconfig/settings_rb.html +52 -0
  47. data/doc/lib/rconfig/utils_rb.html +52 -0
  48. data/doc/lib/rconfig_rb.html +151 -0
  49. data/doc/rdoc.css +706 -0
  50. data/lib/rconfig.rb +1 -1
  51. data/lib/rconfig/load_paths.rb +2 -2
  52. data/lib/tasks/rdoc.rake +3 -4
  53. data/rconfig.gemspec +4 -2
  54. data/spec/config/erb_contents.yml +3 -0
  55. data/spec/config/props_config.conf +18 -0
  56. data/spec/config/spec.yml +17 -0
  57. data/spec/config/xml_config.xml +22 -0
  58. data/spec/config2/.gitkeep +0 -0
  59. data/spec/rconfig/load_paths_spec.rb +37 -0
  60. data/spec/rconfig/reload_spec.rb +37 -0
  61. data/spec/rconfig_spec.rb +61 -3
  62. data/spec/spec_helper.rb +12 -8
  63. metadata +82 -40
  64. data/doc/classes/ClassVariables.html +0 -111
  65. data/doc/classes/ConfigError.html +0 -120
  66. data/doc/classes/ConfigHash.html +0 -354
  67. data/doc/classes/Constants.html +0 -226
  68. data/doc/classes/Hash.html +0 -269
  69. data/doc/classes/InvalidConfigPathError.html +0 -119
  70. data/doc/classes/Object.html +0 -220
  71. data/doc/classes/PropertiesFileParser.html +0 -282
  72. data/doc/classes/RConfig.html +0 -1745
  73. data/doc/files/README_rdoc.html +0 -271
  74. data/doc/files/lib/rconfig/class_variables_rb.html +0 -107
  75. data/doc/files/lib/rconfig/config_hash_rb.html +0 -114
  76. data/doc/files/lib/rconfig/constants_rb.html +0 -101
  77. data/doc/files/lib/rconfig/core_ext/hash_rb.html +0 -114
  78. data/doc/files/lib/rconfig/core_ext/object_rb.html +0 -101
  79. data/doc/files/lib/rconfig/core_ext_rb.html +0 -114
  80. data/doc/files/lib/rconfig/exceptions_rb.html +0 -110
  81. data/doc/files/lib/rconfig/properties_file_parser_rb.html +0 -146
  82. data/doc/files/lib/rconfig/rconfig_rb.html +0 -186
  83. data/doc/files/lib/rconfig_rb.html +0 -117
  84. data/doc/fr_class_index.html +0 -35
  85. data/doc/fr_file_index.html +0 -37
  86. data/doc/fr_method_index.html +0 -75
  87. data/doc/rdoc-style.css +0 -208
  88. data/lib/tasks/gem.rake +0 -14
  89. data/lib/tasks/spec.rake +0 -25
  90. data/spec/core_ext/object_spec.rb +0 -44
@@ -1,226 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Module: Constants</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Module</strong></td>
53
- <td class="class-name-in-header">Constants</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/rconfig/constants_rb.html">
59
- lib/rconfig/constants.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- </table>
66
- </div>
67
- <!-- banner header -->
68
-
69
- <div id="bodyContent">
70
-
71
-
72
-
73
- <div id="contextContent">
74
-
75
-
76
-
77
- </div>
78
-
79
-
80
- </div>
81
-
82
-
83
- <!-- if includes -->
84
-
85
- <div id="section">
86
-
87
-
88
- <div id="constants-list">
89
- <h3 class="section-bar">Constants</h3>
90
-
91
- <div class="name-list">
92
- <table summary="Constants">
93
- <tr class="top-aligned-row context-row">
94
- <td class="context-item-name">CONFIG_ROOT</td>
95
- <td>=</td>
96
- <td class="context-item-value">RAILS_ROOT + &quot;/config&quot; if defined?(RAILS_ROOT) &amp;&amp; defined?(CONFIG_ROOT)</td>
97
- <td width="3em">&nbsp;</td>
98
- <td class="context-item-desc">
99
- Sets CONFIG_ROOT to RAILS_ROOT/config unless it has already been defined
100
- (i.e. in rails env, or calling ruby app).
101
-
102
- </td>
103
- </tr>
104
- <tr class="top-aligned-row context-row">
105
- <td class="context-item-name">ENV_TIER</td>
106
- <td>=</td>
107
- <td class="context-item-value">(defined?(RAILS_ENV) ? RAILS_ENV : (ENV['TIER'] || 'production')) unless defined? ENV_TIER</td>
108
- <td width="3em">&nbsp;</td>
109
- <td class="context-item-desc">
110
- ENV TIER i.e. (development, integration, staging, or production) Defaults
111
- to RAILS_ENV if running in Rails, otherwise, it checks if
112
- ENV[&#8216;TIER&#8217;] is present. If not, it assumes production.
113
-
114
- </td>
115
- </tr>
116
- <tr class="top-aligned-row context-row">
117
- <td class="context-item-name">YML_FILE_TYPES</td>
118
- <td>=</td>
119
- <td class="context-item-value">[:yml, :yaml] unless defined? YML_FILE_TYPES</td>
120
- <td width="3em">&nbsp;</td>
121
- <td class="context-item-desc">
122
- yml, yaml =&gt; yaml files, parsable by YAML library
123
-
124
- </td>
125
- </tr>
126
- <tr class="top-aligned-row context-row">
127
- <td class="context-item-name">XML_FILE_TYPES</td>
128
- <td>=</td>
129
- <td class="context-item-value">[:xml] unless defined? XML_FILE_TYPES</td>
130
- <td width="3em">&nbsp;</td>
131
- <td class="context-item-desc">
132
- xml =&gt; self-explanatory
133
-
134
- </td>
135
- </tr>
136
- <tr class="top-aligned-row context-row">
137
- <td class="context-item-name">CNF_FILE_TYPES</td>
138
- <td>=</td>
139
- <td class="context-item-value">[:cnf, :conf, :config, :properties] unless defined? CNF_FILE_TYPES</td>
140
- <td width="3em">&nbsp;</td>
141
- <td class="context-item-desc">
142
- conf, properties =&gt; &lt;key=value&gt; based config files
143
-
144
- </td>
145
- </tr>
146
- <tr class="top-aligned-row context-row">
147
- <td class="context-item-name">CONFIG_FILE_TYPES</td>
148
- <td>=</td>
149
- <td class="context-item-value">YML_FILE_TYPES + XML_FILE_TYPES + CNF_FILE_TYPES unless defined? CONFIG_FILE_TYPES</td>
150
- <td width="3em">&nbsp;</td>
151
- <td class="context-item-desc">
152
- The type of file used for config. Valid choices include (yml, yaml, xml,
153
- conf, config, properties)
154
-
155
- </td>
156
- </tr>
157
- <tr class="top-aligned-row context-row">
158
- <td class="context-item-name">HOSTNAME</td>
159
- <td>=</td>
160
- <td class="context-item-value">ENV['CONFIG_HOSTNAME'] || Socket.gethostname unless defined? HOSTNAME</td>
161
- <td width="3em">&nbsp;</td>
162
- <td class="context-item-desc">
163
- Use CONFIG_HOSTNAME environment variable to test host-based configurations.
164
-
165
- </td>
166
- </tr>
167
- <tr class="top-aligned-row context-row">
168
- <td class="context-item-name">HOSTNAME_SHORT</td>
169
- <td>=</td>
170
- <td class="context-item-value">HOSTNAME.sub(/\..*$/, '').freeze unless defined? HOSTNAME_SHORT</td>
171
- <td width="3em">&nbsp;</td>
172
- <td class="context-item-desc">
173
- Short Hostname: removes all chars from HOSTNAME, after first &quot;.&quot;
174
- Used to specify machine-specific config files.
175
-
176
- </td>
177
- </tr>
178
- <tr class="top-aligned-row context-row">
179
- <td class="context-item-name">SUFFIXES</td>
180
- <td>=</td>
181
- <td class="context-item-value">[nil, :local, :config, :local_config, ENV_TIER, [ENV_TIER, :local], HOSTNAME_SHORT, [HOSTNAME_SHORT, :config_local], HOSTNAME, [HOSTNAME, :config_local]</td>
182
- <td width="3em">&nbsp;</td>
183
- <td class="context-item-desc">
184
- This is an array of filename suffixes facilitates overriding configuration
185
- (i.e. &#8216;services_local&#8217;, &#8216;services_development&#8217;).
186
- These files get loaded in order of the array the last file loaded gets
187
- splatted on top of everything there. Ex. database_whiskey.yml overrides
188
- database_integration.yml
189
-
190
- <pre>
191
- overrides database.yml
192
- </pre>
193
- </td>
194
- </tr>
195
- <tr class="top-aligned-row context-row">
196
- <td class="context-item-name">EMPTY_ARRAY</td>
197
- <td>=</td>
198
- <td class="context-item-value">[].freeze unless defined? EMPTY_ARRAY</td>
199
- <td width="3em">&nbsp;</td>
200
- <td class="context-item-desc">
201
- Used in place of undefined but expected arrays, to prevent creating a bunch
202
- of unecesary arrays in memory. See ConfigCore.fire_on_load
203
-
204
- </td>
205
- </tr>
206
- </table>
207
- </div>
208
- </div>
209
-
210
-
211
-
212
-
213
-
214
-
215
- <!-- if method_list -->
216
-
217
-
218
- </div>
219
-
220
-
221
- <div id="validator-badges">
222
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
223
- </div>
224
-
225
- </body>
226
- </html>
@@ -1,269 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: Hash</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">Hash</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/rconfig/core_ext/hash_rb.html">
59
- lib/rconfig/core_ext/hash.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- <a href="Object.html">
69
- Object
70
- </a>
71
- </td>
72
- </tr>
73
- </table>
74
- </div>
75
- <!-- banner header -->
76
-
77
- <div id="bodyContent">
78
-
79
-
80
-
81
- <div id="contextContent">
82
-
83
- <div id="description">
84
- <p>
85
- source: <a
86
- href="http://rubyforge.org/projects/facets">rubyforge.org/projects/facets</a>/
87
- version: 1.7.46 license: Ruby License NOTE: remove this method if the
88
- Facets gem is installed. BUG: <a href="Hash.html#M000010">weave</a> is
89
- destructive to values in the source hash that are arrays!
90
- </p>
91
- <pre>
92
- (this is acceptable for RConfig's use as the basis for weave!)
93
- </pre>
94
-
95
- </div>
96
-
97
-
98
- </div>
99
-
100
- <div id="method-list">
101
- <h3 class="section-bar">Methods</h3>
102
-
103
- <div class="name-list">
104
- <a href="#M000010">weave</a>&nbsp;&nbsp;
105
- <a href="#M000011">weave!</a>&nbsp;&nbsp;
106
- </div>
107
- </div>
108
-
109
- </div>
110
-
111
-
112
- <!-- if includes -->
113
-
114
- <div id="section">
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
- <!-- if method_list -->
124
- <div id="methods">
125
- <h3 class="section-bar">Public Instance methods</h3>
126
-
127
- <div id="method-M000010" class="method-detail">
128
- <a name="M000010"></a>
129
-
130
- <div class="method-heading">
131
- <a href="#M000010" class="method-signature">
132
- <span class="method-name">weave</span><span class="method-args">(other_hash, clobber = false)</span>
133
- </a>
134
- </div>
135
-
136
- <div class="method-description">
137
- <p>
138
- Weaves the contents of two hashes producing a new hash.
139
- </p>
140
- <p><a class="source-toggle" href="#"
141
- onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
142
- <div class="method-source-code" id="M000010-source">
143
- <pre>
144
- <span class="ruby-comment cmt"># File lib/rconfig/core_ext/hash.rb, line 14</span>
145
- <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>)
146
- <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>
147
- <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>)
148
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;RConfig: (Hash#weave) expected &lt;Hash&gt;, but was &lt;#{other_hash.class}&gt;&quot;</span>
149
- <span class="ruby-keyword kw">end</span>
150
-
151
- <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>
152
-
153
- <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>
154
-
155
- <span class="ruby-identifier">self_dup</span>[<span class="ruby-identifier">key</span>] =
156
-
157
- <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>]
158
-
159
- <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">self_node</span>
160
- <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Hash</span>
161
-
162
- <span class="ruby-comment cmt"># hash1, hash2 =&gt; hash3 (recursive +)</span>
163
- <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>)
164
-
165
- <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>)
166
-
167
- <span class="ruby-comment cmt"># hash, array =&gt; error (Can't weave'em, must clobber.)</span>
168
- <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">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">clobber</span>
169
-
170
- <span class="ruby-identifier">raise</span>(<span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;RConfig: (Hash#weave) Can't weave Hash and Array&quot;</span>)
171
-
172
- <span class="ruby-comment cmt"># hash, array =&gt; hash[key] = array</span>
173
- <span class="ruby-comment cmt"># hash, value =&gt; hash[key] = value</span>
174
- <span class="ruby-keyword kw">else</span>
175
- <span class="ruby-identifier">other_node</span>
176
- <span class="ruby-keyword kw">end</span>
177
-
178
- <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Array</span>
179
-
180
- <span class="ruby-comment cmt"># array, hash =&gt; array &lt;&lt; hash</span>
181
- <span class="ruby-comment cmt"># array1, array2 =&gt; array1 + array2</span>
182
- <span class="ruby-comment cmt"># array, value =&gt; array &lt;&lt; value</span>
183
- <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">clobber</span>
184
- <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">other_node</span>
185
- <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Hash</span>
186
- <span class="ruby-identifier">self_node</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">other_node</span>
187
- <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Array</span>
188
- <span class="ruby-identifier">self_node</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">other_node</span>
189
- <span class="ruby-keyword kw">else</span>
190
- <span class="ruby-identifier">self_node</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">other_node</span>
191
- <span class="ruby-keyword kw">end</span>
192
-
193
- <span class="ruby-comment cmt"># array, hash =&gt; hash</span>
194
- <span class="ruby-comment cmt"># array1, array2 =&gt; array2</span>
195
- <span class="ruby-comment cmt"># array, value =&gt; value</span>
196
- <span class="ruby-keyword kw">else</span>
197
- <span class="ruby-identifier">other_node</span>
198
- <span class="ruby-keyword kw">end</span>
199
-
200
- <span class="ruby-keyword kw">else</span>
201
-
202
- <span class="ruby-comment cmt"># value, array =&gt; array.unshift(value)</span>
203
- <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">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">clobber</span>
204
- <span class="ruby-identifier">other_node</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">self_node</span>)
205
-
206
- <span class="ruby-comment cmt"># value1, value2 =&gt; value2</span>
207
- <span class="ruby-keyword kw">else</span>
208
- <span class="ruby-identifier">other_node</span>
209
- <span class="ruby-keyword kw">end</span>
210
-
211
- <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># case self_node</span>
212
-
213
- <span class="ruby-comment cmt"># Target hash didn't have a node matching the key, </span>
214
- <span class="ruby-comment cmt"># so just add it from the source hash.</span>
215
- <span class="ruby-comment cmt"># !self_dup.has_key?(key) =&gt; self_dup.add(key, other_node)</span>
216
- <span class="ruby-keyword kw">else</span>
217
- <span class="ruby-identifier">other_node</span>
218
- <span class="ruby-keyword kw">end</span>
219
-
220
- } <span class="ruby-comment cmt"># other_hash.each</span>
221
-
222
- <span class="ruby-identifier">self_dup</span> <span class="ruby-comment cmt"># return new weaved hash</span>
223
- <span class="ruby-keyword kw">end</span>
224
- </pre>
225
- </div>
226
- </div>
227
- </div>
228
-
229
- <div id="method-M000011" class="method-detail">
230
- <a name="M000011"></a>
231
-
232
- <div class="method-heading">
233
- <a href="#M000011" class="method-signature">
234
- <span class="method-name">weave!</span><span class="method-args">(other_hash, clobber = false)</span>
235
- </a>
236
- </div>
237
-
238
- <div class="method-description">
239
- <p>
240
- Same as self.weave(other_hash, dont_clobber) except that it weaves other
241
- hash to itself, rather than create a new hash.
242
- </p>
243
- <p><a class="source-toggle" href="#"
244
- onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
245
- <div class="method-source-code" id="M000011-source">
246
- <pre>
247
- <span class="ruby-comment cmt"># File lib/rconfig/core_ext/hash.rb, line 97</span>
248
- <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>)
249
- <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>)
250
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">weaved_hash</span>)
251
- <span class="ruby-keyword kw">end</span>
252
- </pre>
253
- </div>
254
- </div>
255
- </div>
256
-
257
-
258
- </div>
259
-
260
-
261
- </div>
262
-
263
-
264
- <div id="validator-badges">
265
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
266
- </div>
267
-
268
- </body>
269
- </html>