cascading-configuration-hash 1.6.0 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cascading-configuration-hash/CascadingConfiguration/Hash/Interface.rb +7 -7
- data/lib/cascading-configuration-hash/_private_/CascadingConfiguration/Hash/CompositingHash.rb +4 -4
- data/lib/cascading-configuration-hash/_private_/CascadingConfiguration/Hash/Interface/GettersSetters.rb +22 -79
- data/lib/cascading-configuration-hash/_private_/CascadingConfiguration/Hash/ModuleSupportMethods.rb +2 -2
- metadata +34 -42
@@ -14,7 +14,7 @@ module CascadingConfiguration::Hash::Interface
|
|
14
14
|
|
15
15
|
configuration_names.each do |this_configuration_name|
|
16
16
|
if block_given?
|
17
|
-
::CascadingConfiguration::Variable
|
17
|
+
::CascadingConfiguration::Variable.set_compositing_proc( self,
|
18
18
|
this_configuration_name,
|
19
19
|
compositing_block )
|
20
20
|
end
|
@@ -38,7 +38,7 @@ module CascadingConfiguration::Hash::Interface
|
|
38
38
|
|
39
39
|
configuration_names.each do |this_configuration_name|
|
40
40
|
if block_given?
|
41
|
-
::CascadingConfiguration::Variable
|
41
|
+
::CascadingConfiguration::Variable.set_compositing_proc( self,
|
42
42
|
this_configuration_name,
|
43
43
|
compositing_block )
|
44
44
|
end
|
@@ -61,11 +61,11 @@ module CascadingConfiguration::Hash::Interface
|
|
61
61
|
# configuration does not cascade
|
62
62
|
def attr_local_configuration_hash( *configuration_names, & compositing_block )
|
63
63
|
|
64
|
-
::CascadingConfiguration::Variable
|
64
|
+
::CascadingConfiguration::Variable.create_local_instance_configuration_support_module( self )
|
65
65
|
|
66
66
|
configuration_names.each do |this_configuration_name|
|
67
67
|
if block_given?
|
68
|
-
::CascadingConfiguration::Variable
|
68
|
+
::CascadingConfiguration::Variable.set_compositing_proc( self,
|
69
69
|
this_configuration_name,
|
70
70
|
compositing_block )
|
71
71
|
end
|
@@ -87,11 +87,11 @@ module CascadingConfiguration::Hash::Interface
|
|
87
87
|
# configuration does not cascade
|
88
88
|
def attr_object_configuration_hash( *configuration_names, & compositing_block )
|
89
89
|
|
90
|
-
::CascadingConfiguration::Variable
|
90
|
+
::CascadingConfiguration::Variable.create_local_instance_configuration_support_module( self )
|
91
91
|
|
92
92
|
configuration_names.each do |this_configuration_name|
|
93
93
|
if block_given?
|
94
|
-
::CascadingConfiguration::Variable
|
94
|
+
::CascadingConfiguration::Variable.set_compositing_proc( self,
|
95
95
|
this_configuration_name,
|
96
96
|
compositing_block )
|
97
97
|
end
|
@@ -115,7 +115,7 @@ module CascadingConfiguration::Hash::Interface
|
|
115
115
|
|
116
116
|
configuration_names.each do |this_configuration_name|
|
117
117
|
if block_given?
|
118
|
-
::CascadingConfiguration::Variable
|
118
|
+
::CascadingConfiguration::Variable.set_compositing_proc( self,
|
119
119
|
this_configuration_name,
|
120
120
|
compositing_block )
|
121
121
|
end
|
data/lib/cascading-configuration-hash/_private_/CascadingConfiguration/Hash/CompositingHash.rb
CHANGED
@@ -14,12 +14,12 @@ class CascadingConfiguration::Hash::CompositingHash < ::Hash
|
|
14
14
|
@configuration_name = configuration_name
|
15
15
|
|
16
16
|
# store self for sub composites
|
17
|
-
::CascadingConfiguration::Variable
|
17
|
+
::CascadingConfiguration::Variable.set_configuration_variable( configuration_instance, configuration_name, self )
|
18
18
|
|
19
19
|
# if first ancestor can have a composite hash, register self with it in case it gets updated in the future
|
20
|
-
if ancestor = ::CascadingConfiguration::Variable
|
20
|
+
if ancestor = ::CascadingConfiguration::Variable.ancestor( configuration_instance, configuration_name )
|
21
21
|
|
22
|
-
@super_composite_hash = ::CascadingConfiguration::Variable
|
22
|
+
@super_composite_hash = ::CascadingConfiguration::Variable.get_configuration_variable( ancestor,
|
23
23
|
configuration_name )
|
24
24
|
|
25
25
|
if @super_composite_hash.respond_to?( :register_sub_composite_hash )
|
@@ -188,7 +188,7 @@ class CascadingConfiguration::Hash::CompositingHash < ::Hash
|
|
188
188
|
|
189
189
|
def update_composite_self_for_parent_hash( parent_hash, second_hash )
|
190
190
|
|
191
|
-
if compositing_proc = ::CascadingConfiguration::Variable
|
191
|
+
if compositing_proc = ::CascadingConfiguration::Variable.get_compositing_proc_searching_upward( @configuration_instance, @configuration_name )
|
192
192
|
# if we have a compositing proc defined, use its result to replace
|
193
193
|
parent_hash_copy = { }
|
194
194
|
parent_hash_copy.merge!( parent_hash ) if parent_hash
|
@@ -9,22 +9,14 @@ module CascadingConfiguration::Hash::Interface::GettersSetters
|
|
9
9
|
|
10
10
|
configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
|
11
11
|
|
12
|
-
|
13
|
-
instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.instance_configuration_support_module( self )
|
14
|
-
|
15
|
-
array_setter_proc = Proc.new do |hash|
|
12
|
+
hash_setter_proc = Proc.new do |hash|
|
16
13
|
|
17
14
|
return CascadingConfiguration::Hash.composite_hash_for_cascading_configuration( self, configuration_name ).replace( hash )
|
18
15
|
|
19
16
|
end
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
instance_configuration_support_module.module_eval do
|
26
|
-
define_method( configuration_setter_name, & array_setter_proc )
|
27
|
-
end if instance_configuration_support_module
|
18
|
+
::CascadingConfiguration::Variable.define_module_method( self, configuration_setter_name, & hash_setter_proc )
|
19
|
+
::CascadingConfiguration::Variable.define_instance_method_if_support_exists( self, configuration_setter_name, & hash_setter_proc )
|
28
20
|
|
29
21
|
end
|
30
22
|
|
@@ -36,22 +28,14 @@ module CascadingConfiguration::Hash::Interface::GettersSetters
|
|
36
28
|
|
37
29
|
configuration_getter_name = configuration_name
|
38
30
|
|
39
|
-
|
40
|
-
instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.instance_configuration_support_module( self )
|
41
|
-
|
42
|
-
array_getter_proc = Proc.new do
|
31
|
+
hash_getter_proc = Proc.new do
|
43
32
|
|
44
33
|
return CascadingConfiguration::Hash.composite_hash_for_cascading_configuration( self, configuration_name )
|
45
34
|
|
46
35
|
end
|
47
36
|
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
instance_configuration_support_module.module_eval do
|
53
|
-
define_method( configuration_getter_name, & array_getter_proc )
|
54
|
-
end if instance_configuration_support_module
|
37
|
+
::CascadingConfiguration::Variable.define_module_method( self, configuration_getter_name, & hash_getter_proc )
|
38
|
+
::CascadingConfiguration::Variable.define_instance_method_if_support_exists( self, configuration_getter_name, & hash_getter_proc )
|
55
39
|
|
56
40
|
end
|
57
41
|
|
@@ -63,14 +47,10 @@ module CascadingConfiguration::Hash::Interface::GettersSetters
|
|
63
47
|
|
64
48
|
configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
|
65
49
|
|
66
|
-
|
67
|
-
|
68
|
-
configuration_support_module.module_eval do
|
69
|
-
define_method( configuration_setter_name ) do |hash|
|
50
|
+
::CascadingConfiguration::Variable.define_module_method( self, configuration_setter_name ) do |hash|
|
70
51
|
|
71
|
-
|
52
|
+
return CascadingConfiguration::Hash.composite_hash_for_cascading_configuration( self, configuration_name ).replace( hash )
|
72
53
|
|
73
|
-
end
|
74
54
|
end
|
75
55
|
|
76
56
|
end
|
@@ -83,14 +63,10 @@ module CascadingConfiguration::Hash::Interface::GettersSetters
|
|
83
63
|
|
84
64
|
configuration_getter_name = configuration_name
|
85
65
|
|
86
|
-
|
66
|
+
::CascadingConfiguration::Variable.define_module_method( self, configuration_getter_name ) do
|
87
67
|
|
88
|
-
|
89
|
-
define_method( configuration_getter_name ) do
|
90
|
-
|
91
|
-
return CascadingConfiguration::Hash.composite_hash_for_cascading_configuration( self, configuration_name )
|
68
|
+
return CascadingConfiguration::Hash.composite_hash_for_cascading_configuration( self, configuration_name )
|
92
69
|
|
93
|
-
end
|
94
70
|
end
|
95
71
|
|
96
72
|
end
|
@@ -103,22 +79,14 @@ module CascadingConfiguration::Hash::Interface::GettersSetters
|
|
103
79
|
|
104
80
|
configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
|
105
81
|
|
106
|
-
instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.instance_configuration_support_module( self )
|
107
|
-
local_instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.local_instance_configuration_support_module( self )
|
108
|
-
|
109
82
|
local_setter_proc = Proc.new do |hash|
|
110
83
|
|
111
84
|
return CascadingConfiguration::Hash.composite_hash_for_cascading_configuration( self, configuration_name ).replace( hash )
|
112
85
|
|
113
86
|
end
|
114
87
|
|
115
|
-
|
116
|
-
|
117
|
-
end if instance_configuration_support_module
|
118
|
-
|
119
|
-
local_instance_configuration_support_module.module_eval do
|
120
|
-
define_method( configuration_setter_name, & local_setter_proc )
|
121
|
-
end
|
88
|
+
::CascadingConfiguration::Variable.define_local_instance_method( self, configuration_setter_name, & local_setter_proc )
|
89
|
+
::CascadingConfiguration::Variable.define_instance_method_if_support_exists( self, configuration_setter_name, & local_setter_proc )
|
122
90
|
|
123
91
|
end
|
124
92
|
|
@@ -130,23 +98,14 @@ module CascadingConfiguration::Hash::Interface::GettersSetters
|
|
130
98
|
|
131
99
|
configuration_getter_name = configuration_name
|
132
100
|
|
133
|
-
instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.instance_configuration_support_module( self )
|
134
|
-
|
135
|
-
local_instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.local_instance_configuration_support_module( self )
|
136
|
-
|
137
101
|
local_getter_proc = Proc.new do
|
138
102
|
|
139
103
|
return CascadingConfiguration::Hash.composite_hash_for_cascading_configuration( self, configuration_name )
|
140
104
|
|
141
105
|
end
|
142
106
|
|
143
|
-
|
144
|
-
|
145
|
-
end if instance_configuration_support_module
|
146
|
-
|
147
|
-
local_instance_configuration_support_module.module_eval do
|
148
|
-
define_method( configuration_getter_name, & local_getter_proc )
|
149
|
-
end
|
107
|
+
::CascadingConfiguration::Variable.define_local_instance_method( self, configuration_getter_name, & local_getter_proc )
|
108
|
+
::CascadingConfiguration::Variable.define_instance_method_if_support_exists( self, configuration_getter_name, & local_getter_proc )
|
150
109
|
|
151
110
|
end
|
152
111
|
|
@@ -158,14 +117,10 @@ module CascadingConfiguration::Hash::Interface::GettersSetters
|
|
158
117
|
|
159
118
|
configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
|
160
119
|
|
161
|
-
|
120
|
+
::CascadingConfiguration::Variable.define_instance_method( self, configuration_setter_name ) do |hash|
|
162
121
|
|
163
|
-
|
164
|
-
define_method( configuration_setter_name ) do |hash|
|
165
|
-
|
166
|
-
return CascadingConfiguration::Hash.composite_hash_for_cascading_configuration( self, configuration_name ).replace( hash )
|
122
|
+
return CascadingConfiguration::Hash.composite_hash_for_cascading_configuration( self, configuration_name ).replace( hash )
|
167
123
|
|
168
|
-
end
|
169
124
|
end
|
170
125
|
|
171
126
|
end
|
@@ -178,14 +133,10 @@ module CascadingConfiguration::Hash::Interface::GettersSetters
|
|
178
133
|
|
179
134
|
configuration_getter_name = configuration_name
|
180
135
|
|
181
|
-
|
182
|
-
|
183
|
-
instance_configuration_support_module.module_eval do
|
184
|
-
define_method( configuration_getter_name ) do
|
136
|
+
::CascadingConfiguration::Variable.define_instance_method( self, configuration_getter_name ) do
|
185
137
|
|
186
|
-
|
138
|
+
return CascadingConfiguration::Hash.composite_hash_for_cascading_configuration( self, configuration_name )
|
187
139
|
|
188
|
-
end
|
189
140
|
end
|
190
141
|
|
191
142
|
end
|
@@ -198,14 +149,10 @@ module CascadingConfiguration::Hash::Interface::GettersSetters
|
|
198
149
|
|
199
150
|
configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
|
200
151
|
|
201
|
-
|
202
|
-
|
203
|
-
local_instance_configuration_support_module.module_eval do
|
204
|
-
define_method( configuration_setter_name ) do |hash|
|
152
|
+
::CascadingConfiguration::Variable.define_local_instance_method( self, configuration_setter_name ) do |hash|
|
205
153
|
|
206
|
-
|
154
|
+
return CascadingConfiguration::Hash.composite_hash_for_cascading_configuration( self, configuration_name ).replace( hash )
|
207
155
|
|
208
|
-
end
|
209
156
|
end
|
210
157
|
|
211
158
|
end
|
@@ -218,14 +165,10 @@ module CascadingConfiguration::Hash::Interface::GettersSetters
|
|
218
165
|
|
219
166
|
configuration_getter_name = configuration_name
|
220
167
|
|
221
|
-
|
222
|
-
|
223
|
-
local_instance_configuration_support_module.module_eval do
|
224
|
-
define_method( configuration_getter_name ) do
|
168
|
+
::CascadingConfiguration::Variable.define_local_instance_method( self, configuration_getter_name ) do
|
225
169
|
|
226
|
-
|
170
|
+
return CascadingConfiguration::Hash.composite_hash_for_cascading_configuration( self, configuration_name )
|
227
171
|
|
228
|
-
end
|
229
172
|
end
|
230
173
|
|
231
174
|
end
|
data/lib/cascading-configuration-hash/_private_/CascadingConfiguration/Hash/ModuleSupportMethods.rb
CHANGED
@@ -9,8 +9,8 @@ module CascadingConfiguration::Hash::ModuleSupportMethods
|
|
9
9
|
|
10
10
|
composite_hash = nil
|
11
11
|
|
12
|
-
if ::CascadingConfiguration::Variable
|
13
|
-
composite_hash = ::CascadingConfiguration::Variable
|
12
|
+
if ::CascadingConfiguration::Variable.has_configuration_variable?( configuration_instance, configuration_name )
|
13
|
+
composite_hash = ::CascadingConfiguration::Variable.get_configuration_variable( configuration_instance, configuration_name )
|
14
14
|
else
|
15
15
|
composite_hash = ::CascadingConfiguration::Hash::CompositingHash.new( configuration_instance, configuration_name )
|
16
16
|
end
|
metadata
CHANGED
@@ -1,48 +1,44 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: cascading-configuration-hash
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.6.2
|
4
5
|
prerelease:
|
5
|
-
version: 1.6.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Asher
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-02-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: module-cluster
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70173537181800 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
24
22
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: cascading-configuration-variable
|
28
23
|
prerelease: false
|
29
|
-
|
24
|
+
version_requirements: *70173537181800
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: cascading-configuration-variable
|
27
|
+
requirement: &70173537180500 !ruby/object:Gem::Requirement
|
30
28
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version:
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
35
33
|
type: :runtime
|
36
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70173537180500
|
37
36
|
description: Provides :attr_configuration_hash.
|
38
37
|
email: asher@ridiculouspower.com
|
39
38
|
executables: []
|
40
|
-
|
41
39
|
extensions: []
|
42
|
-
|
43
40
|
extra_rdoc_files: []
|
44
|
-
|
45
|
-
files:
|
41
|
+
files:
|
46
42
|
- lib/cascading-configuration-hash/_private_/CascadingConfiguration/Hash/CompositingHash/LocalConfigurationHash.rb
|
47
43
|
- lib/cascading-configuration-hash/_private_/CascadingConfiguration/Hash/CompositingHash.rb
|
48
44
|
- lib/cascading-configuration-hash/_private_/CascadingConfiguration/Hash/Interface/GettersSetters.rb
|
@@ -57,30 +53,26 @@ files:
|
|
57
53
|
- README.rdoc
|
58
54
|
homepage: http://rubygems.org/gems/cascading-configuration-hash
|
59
55
|
licenses: []
|
60
|
-
|
61
56
|
post_install_message:
|
62
57
|
rdoc_options: []
|
63
|
-
|
64
|
-
require_paths:
|
58
|
+
require_paths:
|
65
59
|
- lib
|
66
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
61
|
none: false
|
68
|
-
requirements:
|
69
|
-
- -
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version:
|
72
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
67
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version:
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
78
72
|
requirements: []
|
79
|
-
|
80
73
|
rubyforge_project: cascading-configuration-hash
|
81
74
|
rubygems_version: 1.8.10
|
82
75
|
signing_key:
|
83
76
|
specification_version: 3
|
84
77
|
summary: Support package for cascading-configuration.
|
85
78
|
test_files: []
|
86
|
-
|