cascading-configuration-array 1.5.1 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cascading-configuration-array/CascadingConfiguration/Array/Interface.rb +2 -2
- data/lib/cascading-configuration-array/_private_/CascadingConfiguration/Array/CompositingArray/LocalConfigurationArray.rb +1 -1
- data/lib/cascading-configuration-array/_private_/CascadingConfiguration/Array/CompositingArray.rb +11 -22
- data/lib/cascading-configuration-array/_private_/CascadingConfiguration/Array/Interface/GettersSetters.rb +18 -18
- data/lib/cascading-configuration-array/_private_/CascadingConfiguration/Array/ModuleSupportMethods.rb +2 -9
- data/spec/_private_/CascadingConfiguration/Array/CompositingArray_spec.rb +22 -0
- metadata +2 -2
@@ -51,7 +51,7 @@ module CascadingConfiguration::Array::Interface
|
|
51
51
|
# configuration does not cascade
|
52
52
|
def attr_local_configuration_array( *configuration_names )
|
53
53
|
|
54
|
-
CascadingConfiguration::Variable.
|
54
|
+
::CascadingConfiguration::Variable::ConfigurationSupport.create_local_instance_configuration_support_module( self )
|
55
55
|
|
56
56
|
configuration_names.each do |this_configuration_name|
|
57
57
|
# define configuration setter
|
@@ -72,7 +72,7 @@ module CascadingConfiguration::Array::Interface
|
|
72
72
|
# configuration does not cascade
|
73
73
|
def attr_object_configuration_array( *configuration_names )
|
74
74
|
|
75
|
-
CascadingConfiguration::Variable.
|
75
|
+
::CascadingConfiguration::Variable::ConfigurationSupport.create_local_instance_configuration_support_module( self )
|
76
76
|
|
77
77
|
configuration_names.each do |this_configuration_name|
|
78
78
|
# define configuration setter
|
data/lib/cascading-configuration-array/_private_/CascadingConfiguration/Array/CompositingArray.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
class CascadingConfiguration::Array::CompositingArray < Array
|
2
|
+
class CascadingConfiguration::Array::CompositingArray < ::Array
|
3
3
|
|
4
4
|
attr_accessor :local_cascading_array
|
5
5
|
|
@@ -9,34 +9,23 @@ class CascadingConfiguration::Array::CompositingArray < Array
|
|
9
9
|
|
10
10
|
def initialize( configuration_instance, configuration_name )
|
11
11
|
|
12
|
-
for_instance = false
|
13
|
-
|
14
12
|
@configuration_instance = configuration_instance
|
15
13
|
|
16
|
-
module_configuration_module = ::CascadingConfiguration::Variable.module_configuration_support_module( configuration_instance )
|
17
|
-
if ! module_configuration_module and ! configuration_instance.is_a?( Module )
|
18
|
-
module_configuration_module = ::CascadingConfiguration::Variable.module_configuration_support_module( configuration_instance.class )
|
19
|
-
for_instance = true
|
20
|
-
end
|
21
|
-
|
22
14
|
@configuration_name = configuration_name
|
23
15
|
|
24
16
|
# store self for sub composites
|
25
|
-
|
17
|
+
::CascadingConfiguration::Variable::ConfigurationSupport.set_configuration_variable( configuration_instance, configuration_name, self )
|
26
18
|
|
27
19
|
# if first ancestor can have a composite array, register self with it in case it gets updated in the future
|
28
|
-
|
29
|
-
if for_instance
|
30
|
-
super_configuration_module = module_configuration_module
|
31
|
-
else
|
32
|
-
super_configuration_module = module_configuration_module.super_configuration_module( configuration_name )
|
33
|
-
end
|
34
|
-
|
35
|
-
if super_configuration_module and
|
36
|
-
@super_composite_array = super_configuration_module.get_configuration_variable( configuration_name ) and
|
37
|
-
@super_composite_array.respond_to?( :register_sub_composite_array )
|
20
|
+
if ancestor = ::CascadingConfiguration::Variable::ConfigurationSupport.ancestor( configuration_instance, configuration_name )
|
38
21
|
|
39
|
-
@super_composite_array.
|
22
|
+
@super_composite_array = ::CascadingConfiguration::Variable::ConfigurationSupport.get_configuration_variable( ancestor,
|
23
|
+
configuration_name )
|
24
|
+
if @super_composite_array.respond_to?( :register_sub_composite_array )
|
25
|
+
@super_composite_array.register_sub_composite_array( self )
|
26
|
+
else
|
27
|
+
@super_composite_array = nil
|
28
|
+
end
|
40
29
|
|
41
30
|
end
|
42
31
|
|
@@ -44,7 +33,7 @@ class CascadingConfiguration::Array::CompositingArray < Array
|
|
44
33
|
@local_cascading_array = ::CascadingConfiguration::Array::CompositingArray::LocalConfigurationArray.new
|
45
34
|
|
46
35
|
# we may later have our own child composites that register with us
|
47
|
-
@sub_composite_arrays =
|
36
|
+
@sub_composite_arrays = [ ]
|
48
37
|
|
49
38
|
# initialize self status for parent and local
|
50
39
|
update_self_as_cascading_composite
|
@@ -9,8 +9,8 @@ module CascadingConfiguration::Array::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.instance_configuration_support_module( self )
|
12
|
+
configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.configuration_support_module( self )
|
13
|
+
instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.instance_configuration_support_module( self )
|
14
14
|
|
15
15
|
array_setter_proc = Proc.new do |array|
|
16
16
|
|
@@ -20,7 +20,7 @@ module CascadingConfiguration::Array::Interface::GettersSetters
|
|
20
20
|
|
21
21
|
end
|
22
22
|
|
23
|
-
|
23
|
+
configuration_support_module.module_eval do
|
24
24
|
define_method( configuration_setter_name, & array_setter_proc )
|
25
25
|
end
|
26
26
|
|
@@ -38,8 +38,8 @@ module CascadingConfiguration::Array::Interface::GettersSetters
|
|
38
38
|
|
39
39
|
configuration_getter_name = configuration_name
|
40
40
|
|
41
|
-
|
42
|
-
instance_configuration_support_module = CascadingConfiguration::Variable.instance_configuration_support_module( self )
|
41
|
+
configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.configuration_support_module( self )
|
42
|
+
instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.instance_configuration_support_module( self )
|
43
43
|
|
44
44
|
array_getter_proc = Proc.new do
|
45
45
|
|
@@ -48,7 +48,7 @@ module CascadingConfiguration::Array::Interface::GettersSetters
|
|
48
48
|
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
configuration_support_module.module_eval do
|
52
52
|
define_method( configuration_getter_name, & array_getter_proc )
|
53
53
|
end
|
54
54
|
|
@@ -66,9 +66,9 @@ module CascadingConfiguration::Array::Interface::GettersSetters
|
|
66
66
|
|
67
67
|
configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
|
68
68
|
|
69
|
-
|
69
|
+
configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.configuration_support_module( self )
|
70
70
|
|
71
|
-
|
71
|
+
configuration_support_module.module_eval do
|
72
72
|
define_method( configuration_setter_name ) do |array|
|
73
73
|
|
74
74
|
return CascadingConfiguration::Array.set_composite_array_for_cascading_configuration( self,
|
@@ -87,9 +87,9 @@ module CascadingConfiguration::Array::Interface::GettersSetters
|
|
87
87
|
|
88
88
|
configuration_getter_name = configuration_name
|
89
89
|
|
90
|
-
|
90
|
+
configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.configuration_support_module( self )
|
91
91
|
|
92
|
-
|
92
|
+
configuration_support_module.module_eval do
|
93
93
|
define_method( configuration_getter_name ) do
|
94
94
|
|
95
95
|
return CascadingConfiguration::Array.composite_array_for_cascading_configuration( self,
|
@@ -108,8 +108,8 @@ module CascadingConfiguration::Array::Interface::GettersSetters
|
|
108
108
|
|
109
109
|
configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
|
110
110
|
|
111
|
-
instance_configuration_support_module = CascadingConfiguration::Variable.instance_configuration_support_module( self )
|
112
|
-
local_instance_configuration_support_module = CascadingConfiguration::Variable.local_instance_configuration_support_module( self )
|
111
|
+
instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.instance_configuration_support_module( self )
|
112
|
+
local_instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.local_instance_configuration_support_module( self )
|
113
113
|
|
114
114
|
local_setter_proc = Proc.new do |array|
|
115
115
|
|
@@ -137,9 +137,9 @@ module CascadingConfiguration::Array::Interface::GettersSetters
|
|
137
137
|
|
138
138
|
configuration_getter_name = configuration_name
|
139
139
|
|
140
|
-
instance_configuration_support_module = CascadingConfiguration::Variable.instance_configuration_support_module( self )
|
140
|
+
instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.instance_configuration_support_module( self )
|
141
141
|
|
142
|
-
local_instance_configuration_support_module = CascadingConfiguration::Variable.local_instance_configuration_support_module( self )
|
142
|
+
local_instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.local_instance_configuration_support_module( self )
|
143
143
|
|
144
144
|
local_getter_proc = Proc.new do
|
145
145
|
|
@@ -166,7 +166,7 @@ module CascadingConfiguration::Array::Interface::GettersSetters
|
|
166
166
|
|
167
167
|
configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
|
168
168
|
|
169
|
-
instance_configuration_support_module = CascadingConfiguration::Variable.instance_configuration_support_module( self )
|
169
|
+
instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.instance_configuration_support_module( self )
|
170
170
|
|
171
171
|
instance_configuration_support_module.module_eval do
|
172
172
|
define_method( configuration_setter_name ) do |array|
|
@@ -187,7 +187,7 @@ module CascadingConfiguration::Array::Interface::GettersSetters
|
|
187
187
|
|
188
188
|
configuration_getter_name = configuration_name
|
189
189
|
|
190
|
-
instance_configuration_support_module = CascadingConfiguration::Variable.instance_configuration_support_module( self )
|
190
|
+
instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.instance_configuration_support_module( self )
|
191
191
|
|
192
192
|
instance_configuration_support_module.module_eval do
|
193
193
|
define_method( configuration_getter_name ) do
|
@@ -208,7 +208,7 @@ module CascadingConfiguration::Array::Interface::GettersSetters
|
|
208
208
|
|
209
209
|
configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
|
210
210
|
|
211
|
-
local_instance_configuration_support_module = CascadingConfiguration::Variable.local_instance_configuration_support_module( self )
|
211
|
+
local_instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.local_instance_configuration_support_module( self )
|
212
212
|
|
213
213
|
local_instance_configuration_support_module.module_eval do
|
214
214
|
define_method( configuration_setter_name ) do |array|
|
@@ -230,7 +230,7 @@ module CascadingConfiguration::Array::Interface::GettersSetters
|
|
230
230
|
|
231
231
|
configuration_getter_name = configuration_name
|
232
232
|
|
233
|
-
local_instance_configuration_support_module = CascadingConfiguration::Variable.local_instance_configuration_support_module( self )
|
233
|
+
local_instance_configuration_support_module = ::CascadingConfiguration::Variable::ConfigurationSupport.local_instance_configuration_support_module( self )
|
234
234
|
|
235
235
|
local_instance_configuration_support_module.module_eval do
|
236
236
|
define_method( configuration_getter_name ) do
|
@@ -8,16 +8,9 @@ module CascadingConfiguration::Array::ModuleSupportMethods
|
|
8
8
|
def composite_array_for_cascading_configuration( configuration_instance, configuration_name )
|
9
9
|
|
10
10
|
composite_array = nil
|
11
|
-
for_instance = false
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
this_object_module_support = CascadingConfiguration::Variable.module_configuration_support_module( configuration_instance.class )
|
16
|
-
for_instance = true
|
17
|
-
end
|
18
|
-
|
19
|
-
if this_object_module_support.has_configuration_variable?( configuration_name, for_instance )
|
20
|
-
composite_array = this_object_module_support.get_configuration_variable( configuration_name, for_instance )
|
12
|
+
if ::CascadingConfiguration::Variable::ConfigurationSupport.has_configuration_variable?( configuration_instance, configuration_name )
|
13
|
+
composite_array = ::CascadingConfiguration::Variable::ConfigurationSupport.get_configuration_variable( configuration_instance, configuration_name )
|
21
14
|
else
|
22
15
|
composite_array = ::CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
|
23
16
|
end
|
@@ -15,6 +15,8 @@ describe CascadingConfiguration::Array::CompositingArray do
|
|
15
15
|
|
16
16
|
module CascadingConfiguration::Array::CompositingArray::CIMock01A
|
17
17
|
include CascadingConfiguration::Array::CompositingArray::CCAMock01
|
18
|
+
def self.some_configuration
|
19
|
+
end
|
18
20
|
end
|
19
21
|
module CascadingConfiguration::Array::CompositingArray::CIMock01B
|
20
22
|
include CascadingConfiguration::Array::CompositingArray::CIMock01A
|
@@ -65,6 +67,8 @@ describe CascadingConfiguration::Array::CompositingArray do
|
|
65
67
|
|
66
68
|
module CascadingConfiguration::Array::CompositingArray::CIMock02A
|
67
69
|
include CascadingConfiguration::Array::CompositingArray::CCAMock02
|
70
|
+
def self.some_configuration
|
71
|
+
end
|
68
72
|
end
|
69
73
|
module CascadingConfiguration::Array::CompositingArray::CIMock02B
|
70
74
|
include CascadingConfiguration::Array::CompositingArray::CIMock02A
|
@@ -115,6 +119,8 @@ describe CascadingConfiguration::Array::CompositingArray do
|
|
115
119
|
|
116
120
|
module CascadingConfiguration::Array::CompositingArray::CIMock03A
|
117
121
|
include CascadingConfiguration::Array::CompositingArray::CCAMock03
|
122
|
+
def self.some_configuration
|
123
|
+
end
|
118
124
|
end
|
119
125
|
module CascadingConfiguration::Array::CompositingArray::CIMock03B
|
120
126
|
include CascadingConfiguration::Array::CompositingArray::CIMock03A
|
@@ -165,6 +171,8 @@ describe CascadingConfiguration::Array::CompositingArray do
|
|
165
171
|
|
166
172
|
module CascadingConfiguration::Array::CompositingArray::CIMock04A
|
167
173
|
include CascadingConfiguration::Array::CompositingArray::CCAMock04
|
174
|
+
def self.some_configuration
|
175
|
+
end
|
168
176
|
end
|
169
177
|
module CascadingConfiguration::Array::CompositingArray::CIMock04B
|
170
178
|
include CascadingConfiguration::Array::CompositingArray::CIMock04A
|
@@ -215,6 +223,8 @@ describe CascadingConfiguration::Array::CompositingArray do
|
|
215
223
|
|
216
224
|
module CascadingConfiguration::Array::CompositingArray::CIMock05A
|
217
225
|
include CascadingConfiguration::Array::CompositingArray::CCAMock05
|
226
|
+
def self.some_configuration
|
227
|
+
end
|
218
228
|
end
|
219
229
|
module CascadingConfiguration::Array::CompositingArray::CIMock05B
|
220
230
|
include CascadingConfiguration::Array::CompositingArray::CIMock05A
|
@@ -265,6 +275,8 @@ describe CascadingConfiguration::Array::CompositingArray do
|
|
265
275
|
|
266
276
|
module CascadingConfiguration::Array::CompositingArray::CIMock06A
|
267
277
|
include CascadingConfiguration::Array::CompositingArray::CCAMock06
|
278
|
+
def self.some_configuration
|
279
|
+
end
|
268
280
|
end
|
269
281
|
module CascadingConfiguration::Array::CompositingArray::CIMock06B
|
270
282
|
include CascadingConfiguration::Array::CompositingArray::CIMock06A
|
@@ -317,6 +329,8 @@ describe CascadingConfiguration::Array::CompositingArray do
|
|
317
329
|
|
318
330
|
module CascadingConfiguration::Array::CompositingArray::CIMock07A
|
319
331
|
include CascadingConfiguration::Array::CompositingArray::CCAMock07
|
332
|
+
def self.some_configuration
|
333
|
+
end
|
320
334
|
end
|
321
335
|
module CascadingConfiguration::Array::CompositingArray::CIMock07B
|
322
336
|
include CascadingConfiguration::Array::CompositingArray::CIMock07A
|
@@ -369,6 +383,8 @@ describe CascadingConfiguration::Array::CompositingArray do
|
|
369
383
|
|
370
384
|
module CascadingConfiguration::Array::CompositingArray::CIMock08A
|
371
385
|
include CascadingConfiguration::Array::CompositingArray::CCAMock08
|
386
|
+
def self.some_configuration
|
387
|
+
end
|
372
388
|
end
|
373
389
|
module CascadingConfiguration::Array::CompositingArray::CIMock08B
|
374
390
|
include CascadingConfiguration::Array::CompositingArray::CIMock08A
|
@@ -421,6 +437,8 @@ describe CascadingConfiguration::Array::CompositingArray do
|
|
421
437
|
|
422
438
|
module CascadingConfiguration::Array::CompositingArray::CIMock09A
|
423
439
|
include CascadingConfiguration::Array::CompositingArray::CCAMock09
|
440
|
+
def self.some_configuration
|
441
|
+
end
|
424
442
|
end
|
425
443
|
module CascadingConfiguration::Array::CompositingArray::CIMock09B
|
426
444
|
include CascadingConfiguration::Array::CompositingArray::CIMock09A
|
@@ -473,6 +491,8 @@ describe CascadingConfiguration::Array::CompositingArray do
|
|
473
491
|
|
474
492
|
module CascadingConfiguration::Array::CompositingArray::CIMock10A
|
475
493
|
include CascadingConfiguration::Array::CompositingArray::CCAMock10
|
494
|
+
def self.some_configuration
|
495
|
+
end
|
476
496
|
end
|
477
497
|
module CascadingConfiguration::Array::CompositingArray::CIMock10B
|
478
498
|
include CascadingConfiguration::Array::CompositingArray::CIMock10A
|
@@ -526,6 +546,8 @@ describe CascadingConfiguration::Array::CompositingArray do
|
|
526
546
|
|
527
547
|
module CascadingConfiguration::Array::CompositingArray::CIMock11A
|
528
548
|
include CascadingConfiguration::Array::CompositingArray::CCAMock11
|
549
|
+
def self.some_configuration
|
550
|
+
end
|
529
551
|
end
|
530
552
|
module CascadingConfiguration::Array::CompositingArray::CIMock11B
|
531
553
|
include CascadingConfiguration::Array::CompositingArray::CIMock11A
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cascading-configuration-array
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.
|
5
|
+
version: 1.6.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Asher
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-02-02 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: module-cluster
|