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
|
@@ -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 <rahmal@gmail.com>
|
|
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>
|
data/doc/classes/ConfigHash.html
DELETED
|
@@ -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 <rahmal@gmail.com>
|
|
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>
|
|
103
|
-
<a href="#M000009">convert_value</a>
|
|
104
|
-
<a href="#M000007">default</a>
|
|
105
|
-
<a href="#M000004">dup</a>
|
|
106
|
-
<a href="#M000005">method_missing</a>
|
|
107
|
-
<a href="#M000008">update</a>
|
|
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 &*#^@*^&$ isn‘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 "convert_value(#{value.inspect}:#{value.class})"</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 => 12345678
|
|
263
|
-
foo.customer.verified.phone => verified
|
|
264
|
-
foo.customer.verified("phone") => verified
|
|
265
|
-
foo.customer.verified(:address) => info_not_available
|
|
266
|
-
foo.customer.verified("name", "employer") =>
|
|
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 "CHF#method_missing(#{method.inspect}, #{args.inspect}) on #{self.inspect}:#{self.class}" 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 => 1 }.update({ :b => 2, :c => 3 })
|
|
319
|
-
=> { :a => 1, :b => 2, :c => 3 }
|
|
320
|
-
|
|
321
|
-
HashWithIndifferentAccess.new({ :a => 1 }).update({ :b => 2, :c => 3 })
|
|
322
|
-
=> { :b => 2, :c => 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>
|