cascading-configuration-array 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +369 -0
- data/README.rdoc +29 -113
- data/lib/cascading-configuration-array/CascadingConfiguration/Array/Accessors.rb +54 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/{ConfigurationSettingsArray → Array}/ClassInstance.rb +5 -3
- data/lib/cascading-configuration-array/CascadingConfiguration/{ConfigurationSettingsArray → Array}/ModuleInstance.rb +7 -4
- data/lib/cascading-configuration-array/CascadingConfiguration/Array.rb +33 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/{CascadingCompositeArray → CompositingArray}/Instance.rb +4 -2
- data/lib/cascading-configuration-array/CascadingConfiguration/{CascadingCompositeArray → CompositingArray}/_private_/Instance.rb +1 -1
- data/lib/cascading-configuration-array/CascadingConfiguration/{CascadingCompositeArray.rb → CompositingArray.rb} +3 -3
- data/lib/cascading-configuration-array/CascadingConfiguration/{ConfigurationArray.rb → LocalConfigurationArray.rb} +2 -2
- data/lib/cascading-configuration-array/CascadingConfiguration/_private_/{CascadingCompositeArray.rb → CompositingArray.rb} +1 -1
- data/lib/cascading-configuration-array/CascadingConfiguration/_private_/{ConfigurationArray.rb → LocalConfigurationArray.rb} +1 -1
- data/lib/cascading-configuration-array.rb +18 -15
- data/spec/CascadingConfiguration/Array/Accessors_spec.rb +28 -0
- data/spec/CascadingConfiguration/{ConfigurationSettingsArray_spec.rb → Array_spec.rb} +20 -20
- data/spec/CascadingConfiguration/{CascadingCompositeArray_spec.rb → CompositingArray_spec.rb} +89 -89
- data/spec/CascadingConfiguration/{ConfigurationArray_spec.rb → LocalConfigurationArray_spec.rb} +12 -12
- metadata +18 -17
- data/lib/cascading-configuration-array/CascadingConfiguration/ConfigurationSettingsArray/Accessors.rb +0 -41
- data/lib/cascading-configuration-array/CascadingConfiguration/ConfigurationSettingsArray.rb +0 -21
- data/spec/CascadingConfiguration/ConfigurationSettingsArray/Accessors_spec.rb +0 -28
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
class CascadingConfiguration::
|
2
|
+
class CascadingConfiguration::LocalConfigurationArray < Array
|
3
3
|
|
4
4
|
attr_accessor :exclude_array
|
5
5
|
|
@@ -8,7 +8,7 @@ class CascadingConfiguration::ConfigurationArray < Array
|
|
8
8
|
################
|
9
9
|
|
10
10
|
def initialize()
|
11
|
-
@exclude_array = Array.new
|
11
|
+
@exclude_array = ::Array.new
|
12
12
|
end
|
13
13
|
|
14
14
|
#########
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
class CascadingConfiguration::
|
2
|
+
class CascadingConfiguration::CompositingArray < Array
|
3
3
|
|
4
4
|
###########################################################################################################
|
5
5
|
private ###############################################################################################
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
class CascadingConfiguration::
|
2
|
+
class CascadingConfiguration::LocalConfigurationArray < Array
|
3
3
|
|
4
4
|
###########################################################################################################
|
5
5
|
private ###############################################################################################
|
@@ -1,15 +1,18 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
2
|
+
if $cascading_configuration_development
|
3
|
+
require_relative '../../variable/lib/cascading-configuration-variable.rb'
|
4
|
+
else
|
5
|
+
require 'cascading-configuration-variable'
|
6
|
+
end
|
4
7
|
|
5
8
|
module CascadingConfiguration
|
6
|
-
class
|
9
|
+
class CompositingArray < Array
|
7
10
|
module Instance
|
8
11
|
end
|
9
12
|
end
|
10
|
-
class
|
13
|
+
class LocalConfigurationArray < Array
|
11
14
|
end
|
12
|
-
module
|
15
|
+
module Array
|
13
16
|
module Accessors
|
14
17
|
end
|
15
18
|
module ClassInstance
|
@@ -21,13 +24,13 @@ module CascadingConfiguration
|
|
21
24
|
end
|
22
25
|
end
|
23
26
|
|
24
|
-
require_relative 'cascading-configuration-array/CascadingConfiguration/
|
25
|
-
require_relative 'cascading-configuration-array/CascadingConfiguration/_private_/
|
26
|
-
require_relative 'cascading-configuration-array/CascadingConfiguration/
|
27
|
-
require_relative 'cascading-configuration-array/CascadingConfiguration/
|
28
|
-
require_relative 'cascading-configuration-array/CascadingConfiguration/
|
29
|
-
require_relative 'cascading-configuration-array/CascadingConfiguration/_private_/
|
30
|
-
require_relative 'cascading-configuration-array/CascadingConfiguration/
|
31
|
-
require_relative 'cascading-configuration-array/CascadingConfiguration/
|
32
|
-
require_relative 'cascading-configuration-array/CascadingConfiguration/
|
33
|
-
require_relative 'cascading-configuration-array/CascadingConfiguration/
|
27
|
+
require_relative 'cascading-configuration-array/CascadingConfiguration/CompositingArray.rb'
|
28
|
+
require_relative 'cascading-configuration-array/CascadingConfiguration/_private_/CompositingArray.rb'
|
29
|
+
require_relative 'cascading-configuration-array/CascadingConfiguration/CompositingArray/Instance.rb'
|
30
|
+
require_relative 'cascading-configuration-array/CascadingConfiguration/CompositingArray/_private_/Instance.rb'
|
31
|
+
require_relative 'cascading-configuration-array/CascadingConfiguration/LocalConfigurationArray.rb'
|
32
|
+
require_relative 'cascading-configuration-array/CascadingConfiguration/_private_/LocalConfigurationArray.rb'
|
33
|
+
require_relative 'cascading-configuration-array/CascadingConfiguration/Array.rb'
|
34
|
+
require_relative 'cascading-configuration-array/CascadingConfiguration/Array/Accessors.rb'
|
35
|
+
require_relative 'cascading-configuration-array/CascadingConfiguration/Array/ClassInstance.rb'
|
36
|
+
require_relative 'cascading-configuration-array/CascadingConfiguration/Array/ModuleInstance.rb'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
require_relative '../../../lib/cascading-configuration-array.rb'
|
3
|
+
|
4
|
+
describe CascadingConfiguration::Array::Accessors do
|
5
|
+
|
6
|
+
###################################
|
7
|
+
# define_cascading_array_setter #
|
8
|
+
# define_cascading_array_getter #
|
9
|
+
###################################
|
10
|
+
|
11
|
+
it 'can define a method to get and modify the configuration array' do
|
12
|
+
class CascadingConfiguration::Array::Mock
|
13
|
+
include CascadingConfiguration::Variable
|
14
|
+
extend CascadingConfiguration::Array::Accessors
|
15
|
+
include CascadingConfiguration::Array::ObjectInstance
|
16
|
+
extend CascadingConfiguration::Array::ClassInstance
|
17
|
+
end
|
18
|
+
# setter
|
19
|
+
CascadingConfiguration::Array::Mock.define_cascading_array_setter( :some_configuration )
|
20
|
+
CascadingConfiguration::Array::Mock.methods.include?( :some_configuration= ).should == true
|
21
|
+
CascadingConfiguration::Array::Mock.instance_methods.include?( :some_configuration= ).should == true
|
22
|
+
# getter
|
23
|
+
CascadingConfiguration::Array::Mock.define_cascading_array_getter( :some_configuration )
|
24
|
+
CascadingConfiguration::Array::Mock.methods.include?( :some_configuration ).should == true
|
25
|
+
CascadingConfiguration::Array::Mock.instance_methods.include?( :some_configuration ).should == true
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
require_relative '../../lib/cascading-configuration-array.rb'
|
3
3
|
|
4
|
-
describe CascadingConfiguration::
|
4
|
+
describe CascadingConfiguration::Array do
|
5
5
|
|
6
6
|
##############################
|
7
7
|
# attr_configuration_array #
|
@@ -9,65 +9,65 @@ describe CascadingConfiguration::ConfigurationSettingsArray do
|
|
9
9
|
|
10
10
|
it 'can define a configuration array, which is the primary interface' do
|
11
11
|
|
12
|
-
module CascadingConfiguration::
|
13
|
-
include CascadingConfiguration::
|
12
|
+
module CascadingConfiguration::Array::MockModule
|
13
|
+
include CascadingConfiguration::Array
|
14
14
|
attr_configuration_array :configuration_setting
|
15
15
|
configuration_setting.should == []
|
16
16
|
configuration_setting.push( :a_configuration )
|
17
17
|
configuration_setting.should == [ :a_configuration ]
|
18
18
|
end
|
19
19
|
|
20
|
-
module CascadingConfiguration::
|
21
|
-
include CascadingConfiguration::
|
20
|
+
module CascadingConfiguration::Array::MockModule2
|
21
|
+
include CascadingConfiguration::Array::MockModule
|
22
22
|
configuration_setting.should == [ :a_configuration ]
|
23
23
|
configuration_setting.push( :another_configuration )
|
24
24
|
configuration_setting.should == [ :a_configuration, :another_configuration ]
|
25
25
|
end
|
26
26
|
|
27
|
-
module CascadingConfiguration::
|
28
|
-
include CascadingConfiguration::
|
27
|
+
module CascadingConfiguration::Array::MockModule3
|
28
|
+
include CascadingConfiguration::Array::MockModule2
|
29
29
|
configuration_setting.should == [ :a_configuration, :another_configuration ]
|
30
30
|
end
|
31
31
|
|
32
|
-
class CascadingConfiguration::
|
33
|
-
include CascadingConfiguration::
|
32
|
+
class CascadingConfiguration::Array::MockClass
|
33
|
+
include CascadingConfiguration::Array::MockModule3
|
34
34
|
configuration_setting.should == [ :a_configuration, :another_configuration ]
|
35
35
|
configuration_setting.delete( :another_configuration )
|
36
36
|
configuration_setting.should == [ :a_configuration ]
|
37
37
|
end
|
38
38
|
|
39
|
-
object_instance_one = CascadingConfiguration::
|
39
|
+
object_instance_one = CascadingConfiguration::Array::MockClass.new
|
40
40
|
object_instance_one.configuration_setting.should == [ :a_configuration ]
|
41
41
|
object_instance_one.configuration_setting.push( :some_other_configuration )
|
42
42
|
object_instance_one.configuration_setting.should == [ :a_configuration, :some_other_configuration ]
|
43
43
|
|
44
|
-
class CascadingConfiguration::
|
44
|
+
class CascadingConfiguration::Array::MockClassSub1 < CascadingConfiguration::Array::MockClass
|
45
45
|
configuration_setting.should == [ :a_configuration ]
|
46
46
|
configuration_setting.push( :another_configuration)
|
47
47
|
configuration_setting.should == [ :a_configuration, :another_configuration ]
|
48
48
|
end
|
49
49
|
|
50
|
-
object_instance_two = CascadingConfiguration::
|
50
|
+
object_instance_two = CascadingConfiguration::Array::MockClassSub1.new
|
51
51
|
object_instance_two.configuration_setting.should == [ :a_configuration, :another_configuration ]
|
52
52
|
object_instance_two.configuration_setting.push( :some_other_configuration )
|
53
53
|
object_instance_two.configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
|
54
54
|
|
55
55
|
# change ancestor setting
|
56
|
-
CascadingConfiguration::
|
57
|
-
CascadingConfiguration::
|
56
|
+
CascadingConfiguration::Array::MockClass.configuration_setting.push( :a_yet_unused_configuration )
|
57
|
+
CascadingConfiguration::Array::MockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration ]
|
58
58
|
object_instance_one.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :some_other_configuration ]
|
59
|
-
CascadingConfiguration::
|
59
|
+
CascadingConfiguration::Array::MockClassSub1.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration ]
|
60
60
|
object_instance_two.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
|
61
61
|
|
62
62
|
# freeze ancestor setting
|
63
63
|
object_instance_one.configuration_setting.freeze!
|
64
64
|
object_instance_one.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :some_other_configuration ]
|
65
|
-
CascadingConfiguration::
|
66
|
-
CascadingConfiguration::
|
67
|
-
CascadingConfiguration::
|
68
|
-
CascadingConfiguration::
|
65
|
+
CascadingConfiguration::Array::MockClassSub1.configuration_setting.freeze!
|
66
|
+
CascadingConfiguration::Array::MockClassSub1.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration ]
|
67
|
+
CascadingConfiguration::Array::MockClass.configuration_setting.push( :non_cascading_configuration )
|
68
|
+
CascadingConfiguration::Array::MockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :non_cascading_configuration ]
|
69
69
|
object_instance_one.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :some_other_configuration ]
|
70
|
-
CascadingConfiguration::
|
70
|
+
CascadingConfiguration::Array::MockClassSub1.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration ]
|
71
71
|
object_instance_two.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
|
72
72
|
|
73
73
|
end
|