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,111 +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: ClassVariables</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">ClassVariables</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/rconfig/class_variables_rb.html">
59
- lib/rconfig/class_variables.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
- <div id="description">
76
- <p>
77
- These are all the variables used to store RConfigs state.
78
- </p>
79
-
80
- </div>
81
-
82
-
83
- </div>
84
-
85
-
86
- </div>
87
-
88
-
89
- <!-- if includes -->
90
-
91
- <div id="section">
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
- <!-- if method_list -->
101
-
102
-
103
- </div>
104
-
105
-
106
- <div id="validator-badges">
107
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
108
- </div>
109
-
110
- </body>
111
- </html>
@@ -1,120 +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: ConfigError</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">ConfigError</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/rconfig/exceptions_rb.html">
59
- lib/rconfig/exceptions.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
- StandardError
69
- </td>
70
- </tr>
71
- </table>
72
- </div>
73
- <!-- banner header -->
74
-
75
- <div id="bodyContent">
76
-
77
-
78
-
79
- <div id="contextContent">
80
-
81
- <div id="description">
82
- <p>
83
- Copyright (c) 2009 Rahmal Conda &lt;rahmal@gmail.com&gt;
84
- </p>
85
- <p>
86
- <a href="RConfig.html">RConfig</a> Exceptions
87
- </p>
88
-
89
- </div>
90
-
91
-
92
- </div>
93
-
94
-
95
- </div>
96
-
97
-
98
- <!-- if includes -->
99
-
100
- <div id="section">
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
- <!-- if method_list -->
110
-
111
-
112
- </div>
113
-
114
-
115
- <div id="validator-badges">
116
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
117
- </div>
118
-
119
- </body>
120
- </html>
@@ -1,354 +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: ConfigHash</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">ConfigHash</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/rconfig/config_hash_rb.html">
59
- lib/rconfig/config_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
- HashWithIndifferentAccess
69
- </td>
70
- </tr>
71
- </table>
72
- </div>
73
- <!-- banner header -->
74
-
75
- <div id="bodyContent">
76
-
77
-
78
-
79
- <div id="contextContent">
80
-
81
- <div id="description">
82
- <p>
83
- Copyright (c) 2009 Rahmal Conda &lt;rahmal@gmail.com&gt;
84
- </p>
85
- <p>
86
- <a href="ConfigHash.html">ConfigHash</a> is a special class, derived from
87
- HashWithIndifferentAccess. It was specifically created for handling config
88
- data or creating mock objects from yaml files. It provides a dotted
89
- notation for accessing embedded hash values, similar to the way one might
90
- traverse a object tree.
91
- </p>
92
-
93
- </div>
94
-
95
-
96
- </div>
97
-
98
- <div id="method-list">
99
- <h3 class="section-bar">Methods</h3>
100
-
101
- <div class="name-list">
102
- <a href="#M000006">[]</a>&nbsp;&nbsp;
103
- <a href="#M000009">convert_value</a>&nbsp;&nbsp;
104
- <a href="#M000007">default</a>&nbsp;&nbsp;
105
- <a href="#M000004">dup</a>&nbsp;&nbsp;
106
- <a href="#M000005">method_missing</a>&nbsp;&nbsp;
107
- <a href="#M000008">update</a>&nbsp;&nbsp;
108
- </div>
109
- </div>
110
-
111
- </div>
112
-
113
-
114
- <!-- if includes -->
115
-
116
- <div id="section">
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
- <!-- if method_list -->
126
- <div id="methods">
127
- <h3 class="section-bar">Public Instance methods</h3>
128
-
129
- <div id="method-M000006" class="method-detail">
130
- <a name="M000006"></a>
131
-
132
- <div class="method-heading">
133
- <a href="#M000006" class="method-signature">
134
- <span class="method-name">[]</span><span class="method-args">(key)</span>
135
- </a>
136
- </div>
137
-
138
- <div class="method-description">
139
- <p>
140
- Why the &amp;*#^@*^&amp;$ isn&#8216;t HashWithIndifferentAccess actually
141
- doing this?
142
- </p>
143
- <p><a class="source-toggle" href="#"
144
- onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
145
- <div class="method-source-code" id="M000006-source">
146
- <pre>
147
- <span class="ruby-comment cmt"># File lib/rconfig/config_hash.rb, line 62</span>
148
- <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)
149
- <span class="ruby-identifier">key</span> = <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Symbol</span>)
150
- <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">key</span>)
151
- <span class="ruby-keyword kw">end</span>
152
- </pre>
153
- </div>
154
- </div>
155
- </div>
156
-
157
- <div id="method-M000009" class="method-detail">
158
- <a name="M000009"></a>
159
-
160
- <div class="method-heading">
161
- <a href="#M000009" class="method-signature">
162
- <span class="method-name">convert_value</span><span class="method-args">(value)</span>
163
- </a>
164
- </div>
165
-
166
- <div class="method-description">
167
- <p>
168
- Override WithIndifferentAccess#convert_value return instances of this class
169
- for <a href="Hash.html">Hash</a> values.
170
- </p>
171
- <p><a class="source-toggle" href="#"
172
- onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
173
- <div class="method-source-code" id="M000009-source">
174
- <pre>
175
- <span class="ruby-comment cmt"># File lib/rconfig/config_hash.rb, line 100</span>
176
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_value</span>(<span class="ruby-identifier">value</span>)
177
- <span class="ruby-comment cmt"># STDERR.puts &quot;convert_value(#{value.inspect}:#{value.class})&quot;</span>
178
- <span class="ruby-identifier">value</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Hash</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>).<span class="ruby-identifier">freeze</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">value</span>
179
- <span class="ruby-keyword kw">end</span>
180
- </pre>
181
- </div>
182
- </div>
183
- </div>
184
-
185
- <div id="method-M000007" class="method-detail">
186
- <a name="M000007"></a>
187
-
188
- <div class="method-heading">
189
- <a href="#M000007" class="method-signature">
190
- <span class="method-name">default</span><span class="method-args">(key = @@no_key)</span>
191
- </a>
192
- </div>
193
-
194
- <div class="method-description">
195
- <p><a class="source-toggle" href="#"
196
- onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
197
- <div class="method-source-code" id="M000007-source">
198
- <pre>
199
- <span class="ruby-comment cmt"># File lib/rconfig/config_hash.rb, line 74</span>
200
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default</span>(<span class="ruby-identifier">key</span> = <span class="ruby-ivar">@@no_key</span>)
201
- <span class="ruby-identifier">key</span> = <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>)
202
- <span class="ruby-identifier">key</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@@no_key</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'default'</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">default_Hash</span>(<span class="ruby-identifier">key</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@@no_key</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">key</span>)
203
- <span class="ruby-keyword kw">end</span>
204
- </pre>
205
- </div>
206
- </div>
207
- </div>
208
-
209
- <div id="method-M000004" class="method-detail">
210
- <a name="M000004"></a>
211
-
212
- <div class="method-heading">
213
- <a href="#M000004" class="method-signature">
214
- <span class="method-name">dup</span><span class="method-args">()</span>
215
- </a>
216
- </div>
217
-
218
- <div class="method-description">
219
- <p>
220
- HashWithIndifferentAccess#dup always returns HashWithIndifferentAccess!
221
- </p>
222
- <p><a class="source-toggle" href="#"
223
- onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
224
- <div class="method-source-code" id="M000004-source">
225
- <pre>
226
- <span class="ruby-comment cmt"># File lib/rconfig/config_hash.rb, line 12</span>
227
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dup</span>
228
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
229
- <span class="ruby-keyword kw">end</span>
230
- </pre>
231
- </div>
232
- </div>
233
- </div>
234
-
235
- <div id="method-M000005" class="method-detail">
236
- <a name="M000005"></a>
237
-
238
- <div class="method-heading">
239
- <a href="#M000005" class="method-signature">
240
- <span class="method-name">method_missing</span><span class="method-args">(method, *args)</span>
241
- </a>
242
- </div>
243
-
244
- <div class="method-description">
245
- <p>
246
- Dotted notation can be used with arguments (useful for creating mock
247
- objects) in the YAML file the method name is a key, argument(s) form a
248
- nested key, so that the correct value is retrieved and returned.
249
- </p>
250
- <p>
251
- For example loading to variable foo a yaml file that looks like: customer:
252
- </p>
253
- <pre>
254
- id: 12345678
255
- verified:
256
- phone: verified
257
- :address: info_not_available
258
- ? [name, employer]
259
- : not_verified
260
- </pre>
261
- <p>
262
- Allows the following calls: foo.customer.id =&gt; 12345678
263
- foo.customer.verified.phone =&gt; verified
264
- foo.customer.verified(&quot;phone&quot;) =&gt; verified
265
- foo.customer.verified(:address) =&gt; info_not_available
266
- foo.customer.verified(&quot;name&quot;, &quot;employer&quot;) =&gt;
267
- not_verified
268
- </p>
269
- <p>
270
- Note that :address is specified as a symbol, where phone is just a string.
271
- Depending on what kind of parameter the method being mocked out is going to
272
- be called with, define in the YAML file either a string or a symbol. This
273
- also works inside the composite array keys.
274
- </p>
275
- <p><a class="source-toggle" href="#"
276
- onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
277
- <div class="method-source-code" id="M000005-source">
278
- <pre>
279
- <span class="ruby-comment cmt"># File lib/rconfig/config_hash.rb, line 41</span>
280
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">method</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
281
- <span class="ruby-identifier">method</span> = <span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span>
282
- <span class="ruby-comment cmt"># STDERR.puts &quot;CHF#method_missing(#{method.inspect}, #{args.inspect}) on #{self.inspect}:#{self.class}&quot; if method == 'dup'</span>
283
- <span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">method</span>]
284
- <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span>
285
- <span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span>
286
- <span class="ruby-comment cmt"># e.g.: RConfig.application.method</span>
287
- ;
288
- <span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span>
289
- <span class="ruby-comment cmt"># e.g.: RConfig.application.method(one_arg)</span>
290
- <span class="ruby-identifier">value</span> = <span class="ruby-identifier">value</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>])
291
- <span class="ruby-keyword kw">else</span>
292
- <span class="ruby-comment cmt"># e.g.: RConfig.application.method(arg_one, args_two, ...)</span>
293
- <span class="ruby-identifier">value</span> = <span class="ruby-identifier">value</span>[<span class="ruby-identifier">args</span>]
294
- <span class="ruby-keyword kw">end</span>
295
- <span class="ruby-comment cmt"># value = convert_value(value)</span>
296
- <span class="ruby-identifier">value</span>
297
- <span class="ruby-keyword kw">end</span>
298
- </pre>
299
- </div>
300
- </div>
301
- </div>
302
-
303
- <div id="method-M000008" class="method-detail">
304
- <a name="M000008"></a>
305
-
306
- <div class="method-heading">
307
- <a href="#M000008" class="method-signature">
308
- <span class="method-name">update</span><span class="method-args">(hash)</span>
309
- </a>
310
- </div>
311
-
312
- <div class="method-description">
313
- <p>
314
- HashWithIndifferentAccess#update is broken! Hash#update returns self, BUT,
315
- HashWithIndifferentAccess#update does not!
316
- </p>
317
- <pre>
318
- { :a =&gt; 1 }.update({ :b =&gt; 2, :c =&gt; 3 })
319
- =&gt; { :a =&gt; 1, :b =&gt; 2, :c =&gt; 3 }
320
-
321
- HashWithIndifferentAccess.new({ :a =&gt; 1 }).update({ :b =&gt; 2, :c =&gt; 3 })
322
- =&gt; { :b =&gt; 2, :c =&gt; 3 } # WTF?
323
- </pre>
324
- <p>
325
- Subclasses should <b>never</b> override methods and break their
326
- protocols!!!!
327
- </p>
328
- <p><a class="source-toggle" href="#"
329
- onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
330
- <div class="method-source-code" id="M000008-source">
331
- <pre>
332
- <span class="ruby-comment cmt"># File lib/rconfig/config_hash.rb, line 92</span>
333
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">hash</span>)
334
- <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">hash</span>)
335
- <span class="ruby-keyword kw">self</span>
336
- <span class="ruby-keyword kw">end</span>
337
- </pre>
338
- </div>
339
- </div>
340
- </div>
341
-
342
-
343
- </div>
344
-
345
-
346
- </div>
347
-
348
-
349
- <div id="validator-badges">
350
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
351
- </div>
352
-
353
- </body>
354
- </html>