cascading-configuration-array 1.1.5 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,13 +13,13 @@ module CascadingConfiguration
13
13
  class LocalConfigurationArray < Array
14
14
  end
15
15
  module Array
16
- module Accessors
16
+ module ConfigurationAccessors
17
17
  end
18
- module ClassInstance
18
+ module Interface
19
19
  end
20
20
  module ObjectInstance
21
21
  end
22
- module ModuleInstance
22
+ module ModuleInclusionExtensionSupport
23
23
  end
24
24
  end
25
25
  end
@@ -30,6 +30,6 @@ require_relative 'cascading-configuration-array/CascadingConfiguration/Compositi
30
30
  require_relative 'cascading-configuration-array/CascadingConfiguration/LocalConfigurationArray.rb'
31
31
  require_relative 'cascading-configuration-array/CascadingConfiguration/_private_/LocalConfigurationArray.rb'
32
32
  require_relative 'cascading-configuration-array/CascadingConfiguration/Array.rb'
33
- require_relative 'cascading-configuration-array/CascadingConfiguration/Array/Accessors.rb'
34
- require_relative 'cascading-configuration-array/CascadingConfiguration/Array/ClassInstance.rb'
35
- require_relative 'cascading-configuration-array/CascadingConfiguration/Array/ModuleInstance.rb'
33
+ require_relative 'cascading-configuration-array/CascadingConfiguration/Array/ConfigurationAccessors.rb'
34
+ require_relative 'cascading-configuration-array/CascadingConfiguration/Array/Interface.rb'
35
+ require_relative 'cascading-configuration-array/CascadingConfiguration/Array/ModuleInclusionExtensionSupport.rb'
@@ -6,6 +6,25 @@ module CascadingConfiguration::Array
6
6
  include CascadingConfiguration::Variable
7
7
  include CascadingConfiguration::CompositingArray::Instance
8
8
 
9
+ ##########################
10
+ # self.append_features #
11
+ ##########################
12
+
13
+ def self.append_features( class_or_module )
14
+ CascadingConfiguration::Variable.define_accessor_instance_support( class_or_module )
15
+ CascadingConfiguration::Variable.define_accessor_module_support( class_or_module )
16
+ super
17
+ end
18
+
19
+ ########################
20
+ # self.extend_object #
21
+ ########################
22
+
23
+ def self.extend_object( class_or_module )
24
+ CascadingConfiguration::Variable.define_accessor_module_support( class_or_module )
25
+ super
26
+ end
27
+
9
28
  ###################
10
29
  # self.included #
11
30
  ###################
@@ -13,11 +32,22 @@ module CascadingConfiguration::Array
13
32
  def self.included( class_or_module )
14
33
  module_self = self
15
34
  class_or_module.instance_eval do
16
- extend module_self
17
- extend module_self::Accessors
18
- extend module_self::ClassInstance
19
- # module support
20
- extend CascadingConfiguration::Array::ModuleInstance unless is_a?( Class )
35
+ extend module_self
36
+ extend module_self::Interface
37
+ extend module_self::ConfigurationAccessors
38
+ extend CascadingConfiguration::Array::ModuleInclusionExtensionSupport unless is_a?( Class )
39
+ end
40
+ end
41
+
42
+ ###################
43
+ # self.extended #
44
+ ###################
45
+
46
+ def self.extended( class_or_module )
47
+ module_self = self
48
+ class_or_module.instance_eval do
49
+ extend module_self::Interface
50
+ extend module_self::ConfigurationAccessors
21
51
  end
22
52
  end
23
53
 
@@ -0,0 +1,107 @@
1
+
2
+ module CascadingConfiguration::Array::ConfigurationAccessors
3
+
4
+ extend CascadingConfiguration::InternalModuleStub
5
+
6
+ ###################################
7
+ # define_cascading_array_setter #
8
+ ###################################
9
+
10
+ def define_cascading_array_setter( configuration_name )
11
+ configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
12
+ self_instance = self
13
+ [ accessor_instance_support, accessor_module_support ].compact.each do |accessor_support_module|
14
+ accessor_support_module.module_eval do
15
+ define_method( configuration_setter_name ) do |array|
16
+ composite_array = composite_array_for_cascading_configuration( configuration_name )
17
+ # we want the array to supplant existing config
18
+ # clear the array (excludes everything explicitly)
19
+ composite_array.clear
20
+ # push array elements (removes anything excluded from exclude)
21
+ composite_array.push( *array )
22
+ return composite_array
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ ###################################
29
+ # define_cascading_array_getter #
30
+ ###################################
31
+
32
+ def define_cascading_array_getter( configuration_name )
33
+ configuration_getter_name = configuration_name
34
+ [ accessor_instance_support, accessor_module_support ].compact.each do |accessor_support_module|
35
+ accessor_support_module.module_eval do
36
+ define_method( configuration_getter_name ) do
37
+ return composite_array_for_cascading_configuration( configuration_name )
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ #############################################
44
+ # define_class_configuration_array_setter #
45
+ #############################################
46
+
47
+ def define_class_configuration_array_setter( configuration_name )
48
+ configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
49
+ accessor_module_support.module_eval do
50
+ define_method( configuration_setter_name ) do |array|
51
+ composite_array = composite_array_for_cascading_configuration( configuration_name )
52
+ # we want the array to supplant existing config
53
+ # clear the array (excludes everything explicitly)
54
+ composite_array.clear
55
+ # push array elements (removes anything excluded from exclude)
56
+ composite_array.push( *array )
57
+ return composite_array
58
+ end
59
+ end
60
+ end
61
+
62
+ #############################################
63
+ # define_class_configuration_array_getter #
64
+ #############################################
65
+
66
+ def define_class_configuration_array_getter( configuration_name )
67
+ configuration_getter_name = configuration_name
68
+ accessor_module_support.module_eval do
69
+ define_method( configuration_getter_name ) do
70
+ return composite_array_for_cascading_configuration( configuration_name )
71
+ end
72
+ end
73
+ end
74
+
75
+ #############################################
76
+ # define_local_configuration_array_setter #
77
+ #############################################
78
+
79
+ def define_local_configuration_array_setter( configuration_name )
80
+ configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
81
+ accessor_instance_support.module_eval do
82
+ define_method( configuration_setter_name ) do |array|
83
+ composite_array = composite_array_for_cascading_configuration( configuration_name )
84
+ # we want the array to supplant existing config
85
+ # clear the array (excludes everything explicitly)
86
+ composite_array.clear
87
+ # push array elements (removes anything excluded from exclude)
88
+ composite_array.push( *array )
89
+ return composite_array
90
+ end
91
+ end
92
+ end
93
+
94
+ #############################################
95
+ # define_local_configuration_array_getter #
96
+ #############################################
97
+
98
+ def define_local_configuration_array_getter( configuration_name )
99
+ configuration_getter_name = configuration_name
100
+ accessor_instance_support.module_eval do
101
+ define_method( configuration_getter_name ) do
102
+ return composite_array_for_cascading_configuration( configuration_name )
103
+ end
104
+ end
105
+ end
106
+
107
+ end
@@ -0,0 +1,51 @@
1
+
2
+ module CascadingConfiguration::Array::Interface
3
+
4
+ extend CascadingConfiguration::InternalModuleStub
5
+
6
+ ##############################
7
+ # attr_configuration_array #
8
+ ##############################
9
+
10
+ # defines configuration in class or module
11
+ # configuration cascades downward to instance including all classes or modules in-between
12
+ def attr_configuration_array( *property_names )
13
+ property_names.each do |this_property_name|
14
+ # define configuration setter
15
+ define_cascading_array_setter( this_property_name )
16
+ # define configuration getter
17
+ define_cascading_array_getter( this_property_name )
18
+ end
19
+ end
20
+
21
+ ####################################
22
+ # attr_class_configuration_array #
23
+ ####################################
24
+
25
+ # defines configuration in class or module
26
+ # configuration cascades downward to last class or module
27
+ def attr_class_configuration_array( *property_names )
28
+ property_names.each do |this_property_name|
29
+ # define configuration setter
30
+ define_class_configuration_array_setter( this_property_name )
31
+ # define configuration getter
32
+ define_class_configuration_array_getter( this_property_name )
33
+ end
34
+ end
35
+
36
+ ####################################
37
+ # attr_local_configuration_array #
38
+ ####################################
39
+
40
+ # defines configuration in present class or module context
41
+ # configuration does not cascade
42
+ def attr_local_configuration_array( *property_names )
43
+ property_names.each do |this_property_name|
44
+ # define configuration setter
45
+ define_local_configuration_array_setter( this_property_name )
46
+ # define configuration getter
47
+ define_local_configuration_array_getter( this_property_name )
48
+ end
49
+ end
50
+
51
+ end
@@ -0,0 +1,38 @@
1
+
2
+ module CascadingConfiguration::Array::ModuleInclusionExtensionSupport
3
+
4
+ extend CascadingConfiguration::InternalModuleStub
5
+
6
+ ##############
7
+ # included #
8
+ ##############
9
+
10
+ def included( class_or_module )
11
+ super if defined?( super )
12
+ # CascadingConfiguration::Array
13
+ module_self = self
14
+ class_or_module.instance_eval do
15
+ # include accessors defined for instances
16
+ include module_self.accessor_instance_support
17
+ # extend accessors defined for modules (and classes, which are modules)
18
+ extend module_self.accessor_module_support
19
+ extend CascadingConfiguration::Array
20
+ extend CascadingConfiguration::Array::ModuleInclusionExtensionSupport unless is_a?( Class )
21
+ end
22
+ end
23
+
24
+ ##############
25
+ # extended #
26
+ ##############
27
+
28
+ def extended( class_or_module )
29
+ super if defined?( super )
30
+ # CascadingConfiguration::Array
31
+ module_self = self
32
+ class_or_module.instance_eval do
33
+ extend module_self.accessor_module_support
34
+ extend CascadingConfiguration::Variable::EigenclassConfigurationChain
35
+ end
36
+ end
37
+
38
+ end
@@ -9,8 +9,8 @@ class CascadingConfiguration::CompositingArray < Array
9
9
 
10
10
  def initialize( cascading_name, working_instance )
11
11
  @cascading_name = cascading_name
12
- working_class = ( working_instance.is_a?( Module ) ? working_instance : working_instance.class )
13
- @cascading_variable = working_class::AccessorSupportModule.cascading_variable_name( @cascading_name )
12
+ @working_class = ( working_instance.is_a?( Module ) ? working_instance : working_instance.class )
13
+ @cascading_variable = @working_class.accessor_module_support.cascading_variable_name( @cascading_name )
14
14
  @working_instance = working_instance
15
15
  # if first ancestor can have a composite array, register self with it in case it gets updated in the future
16
16
  if ( first_ancestor = @working_instance.first_ancestor ).respond_to?( :composite_array_for_cascading_configuration )
@@ -23,9 +23,8 @@ module CascadingConfiguration::CompositingArray::Instance
23
23
  composite_array = nil
24
24
 
25
25
  klass = ( is_a?( Module ) ? self : self.class )
26
- accessor_support_module = klass::AccessorSupportModule
27
26
  self_instance = self
28
- accessor_support_module.instance_eval do
27
+ accessor_module_support.module_eval do
29
28
  unless composite_array = ( ( @composite_arrays ||= Hash.new )[ cascading_name ] ||= Hash.new )[ self_instance ]
30
29
  composite_array = ::CascadingConfiguration::CompositingArray.new( cascading_name, self_instance )
31
30
  @composite_arrays[ cascading_name ][ self_instance ] = composite_array
@@ -1,7 +1,7 @@
1
1
 
2
2
  require_relative '../../../lib/cascading-configuration-array.rb'
3
3
 
4
- describe CascadingConfiguration::Array::Accessors do
4
+ describe CascadingConfiguration::Array::ConfigurationAccessors do
5
5
 
6
6
  ###################################
7
7
  # define_cascading_array_setter #
@@ -11,9 +11,9 @@ describe CascadingConfiguration::Array::Accessors do
11
11
  it 'can define a method to get and modify the configuration array' do
12
12
  class CascadingConfiguration::Array::Mock
13
13
  include CascadingConfiguration::Variable
14
- extend CascadingConfiguration::Array::Accessors
14
+ extend CascadingConfiguration::Array::ConfigurationAccessors
15
15
  include CascadingConfiguration::Array::ObjectInstance
16
- extend CascadingConfiguration::Array::ClassInstance
16
+ extend CascadingConfiguration::Array::Interface
17
17
  end
18
18
  # setter
19
19
  CascadingConfiguration::Array::Mock.define_cascading_array_setter( :some_configuration )
@@ -9,82 +9,156 @@ describe CascadingConfiguration::Array do
9
9
 
10
10
  it 'can define a configuration array, which is the primary interface' do
11
11
 
12
- module CascadingConfiguration::Array::MockModule
13
- include CascadingConfiguration::Array
12
+ # possibilities:
13
+ # * module extended with setting
14
+ # => singleton gets attr_configuration and configurations
15
+ # => including modules and classes get nothing
16
+ # => extending modules and classes get nothing
17
+ # => instances of including and extending classes get nothing
18
+ # * module included with setting
19
+ # => singleton gets attr_configuration and configurations
20
+ # => including modules and classes get attr_configuration and configurations
21
+ # => instances of including classes get configurations
22
+ # => extending modules and classes get attr_configuration and configurations
23
+ # => instances of extending classes get nothing
24
+ module CascadingConfiguration::Array::MockModuleExtended
25
+ extend CascadingConfiguration::Array
26
+ # => singleton gets attr_configuration and configurations
27
+ respond_to?( :attr_configuration_array ).should == true
14
28
  attr_configuration_array :configuration_setting
29
+ respond_to?( :configuration_setting ).should == true
15
30
  configuration_setting.should == []
16
31
  configuration_setting.push( :a_configuration )
17
32
  configuration_setting.should == [ :a_configuration ]
33
+ instance_methods.include?( :configuration_setting ).should == false
34
+ # => including modules and classes get nothing
35
+ module SubmoduleIncluding
36
+ include CascadingConfiguration::Array::MockModuleExtended
37
+ instance_methods.include?( :configuration_setting ).should == false
38
+ respond_to?( :configuration_setting ).should == false
39
+ end
40
+ # => extending modules and classes get nothing
41
+ module SubmoduleExtending
42
+ extend CascadingConfiguration::Array::MockModuleExtended
43
+ instance_methods.include?( :configuration_setting ).should == false
44
+ respond_to?( :configuration_setting ).should == false
45
+ end
46
+ # => instances of including and extending classes get nothing
47
+ class ClassIncluding
48
+ include CascadingConfiguration::Array::MockModuleExtended
49
+ instance_methods.include?( :configuration_setting ).should == false
50
+ respond_to?( :configuration_setting ).should == false
51
+ end
52
+ class ClassExtending
53
+ extend CascadingConfiguration::Array::MockModuleExtended
54
+ instance_methods.include?( :configuration_setting ).should == false
55
+ respond_to?( :configuration_setting ).should == false
56
+ end
18
57
  end
19
58
 
20
- module CascadingConfiguration::Array::MockModule2
21
- include CascadingConfiguration::Array::MockModule
59
+ # * module included with setting
60
+ module CascadingConfiguration::Array::MockModuleIncluded
61
+ include CascadingConfiguration::Array
62
+ # => singleton gets attr_configuration and configurations
63
+ respond_to?( :attr_configuration_array ).should == true
64
+ attr_configuration_array :configuration_setting
65
+ respond_to?( :configuration_setting ).should == true
66
+ configuration_setting.should == []
67
+ configuration_setting.push( :a_configuration )
22
68
  configuration_setting.should == [ :a_configuration ]
23
- configuration_setting.push( :another_configuration )
24
- configuration_setting.should == [ :a_configuration, :another_configuration ]
25
- end
26
-
27
- module CascadingConfiguration::Array::MockModule3
28
- include CascadingConfiguration::Array::MockModule2
29
- configuration_setting.should == [ :a_configuration, :another_configuration ]
69
+ instance_methods.include?( :configuration_setting ).should == true
70
+ # => including modules and classes get attr_configuration and configurations
71
+ module SubmoduleIncluding
72
+ include CascadingConfiguration::Array::MockModuleIncluded
73
+ instance_methods.include?( :configuration_setting ).should == true
74
+ respond_to?( :configuration_setting ).should == true
75
+ configuration_setting.should == [ :a_configuration ]
76
+ configuration_setting.push( :another_configuration )
77
+ configuration_setting.should == [ :a_configuration, :another_configuration ]
78
+ end
79
+ # => extending modules and classes get attr_configuration and configurations
80
+ module SubmoduleExtending
81
+ extend CascadingConfiguration::Array::MockModuleIncluded
82
+ # if we're extended then we want to use the eigenclass ancestor chain
83
+ # - the first ancestor will be the extending module
84
+ # - the rest of the ancestors will be the extending module's include chain
85
+ respond_to?( :configuration_setting ).should == true
86
+ configuration_setting.should == [ :a_configuration ]
87
+ configuration_setting.push( :some_other_configuration )
88
+ configuration_setting.should == [ :a_configuration, :some_other_configuration ]
89
+ instance_methods.include?( :configuration_setting ).should == false
90
+ end
91
+ # => instances of including classes get configurations
92
+ class ClassIncluding
93
+ include CascadingConfiguration::Array::MockModuleIncluded
94
+ instance_methods.include?( :configuration_setting ).should == true
95
+ respond_to?( :configuration_setting ).should == true
96
+ configuration_setting.should == [ :a_configuration ]
97
+ configuration_setting.push( :some_other_configuration )
98
+ configuration_setting.should == [ :a_configuration, :some_other_configuration ]
99
+ end
100
+ setting_class_including_instance = ClassIncluding.new
101
+ setting_class_including_instance.respond_to?( :configuration_setting ).should == true
102
+ setting_class_including_instance.configuration_setting.should == [ :a_configuration, :some_other_configuration ]
103
+ setting_class_including_instance.configuration_setting.delete( :some_other_configuration )
104
+ setting_class_including_instance.configuration_setting = [ :our_setting_value ]
105
+ setting_class_including_instance.configuration_setting.should == [ :our_setting_value ]
106
+ # => instances of extending classes get nothing
107
+ class ClassExtending
108
+ extend CascadingConfiguration::Array::MockModuleIncluded
109
+ respond_to?( :configuration_setting ).should == true
110
+ configuration_setting.should == [ :a_configuration ]
111
+ configuration_setting.push( :some_other_configuration )
112
+ configuration_setting.should == [ :a_configuration, :some_other_configuration ]
113
+ end
114
+ setting_class_including_instance = ClassExtending.new
115
+ setting_class_including_instance.respond_to?( :configuration_setting ).should == false
30
116
  end
31
-
117
+
32
118
  class CascadingConfiguration::Array::MockClass
33
- include CascadingConfiguration::Array::MockModule3
119
+ include CascadingConfiguration::Array::MockModuleIncluded::SubmoduleIncluding
34
120
  configuration_setting.should == [ :a_configuration, :another_configuration ]
35
- configuration_setting.delete( :another_configuration )
36
- configuration_setting.should == [ :a_configuration ]
121
+ configuration_setting.push( :some_other_configuration )
122
+ configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
37
123
  end
38
-
39
124
  object_instance_one = CascadingConfiguration::Array::MockClass.new
40
- object_instance_one.configuration_setting.should == [ :a_configuration ]
41
- object_instance_one.configuration_setting.push( :some_other_configuration )
42
- object_instance_one.configuration_setting.should == [ :a_configuration, :some_other_configuration ]
43
-
125
+ object_instance_one.configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
126
+ object_instance_one.configuration_setting.delete( :a_configuration )
127
+ object_instance_one.configuration_setting.should == [ :another_configuration, :some_other_configuration ]
44
128
  class CascadingConfiguration::Array::MockClassSub1 < CascadingConfiguration::Array::MockClass
45
- configuration_setting.should == [ :a_configuration ]
46
- configuration_setting.push( :another_configuration)
47
- configuration_setting.should == [ :a_configuration, :another_configuration ]
129
+ configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
130
+ configuration_setting.delete( :a_configuration )
131
+ configuration_setting.should == [ :another_configuration, :some_other_configuration ]
48
132
  end
49
-
50
133
  object_instance_two = CascadingConfiguration::Array::MockClassSub1.new
51
- object_instance_two.configuration_setting.should == [ :a_configuration, :another_configuration ]
52
- object_instance_two.configuration_setting.push( :some_other_configuration )
53
- object_instance_two.configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
134
+ object_instance_two.configuration_setting.should == [ :another_configuration, :some_other_configuration ]
135
+ object_instance_two.configuration_setting.delete( :another_configuration )
136
+ object_instance_two.configuration_setting.should == [ :some_other_configuration ]
137
+ class CascadingConfiguration::Array::MockClassSub2 < CascadingConfiguration::Array::MockClassSub1
138
+ configuration_setting.should == [ :another_configuration, :some_other_configuration ]
139
+ configuration_setting.push( :yet_another_configuration )
140
+ configuration_setting.should == [ :another_configuration, :some_other_configuration, :yet_another_configuration ]
141
+ end
54
142
 
55
143
  # change ancestor setting
144
+ CascadingConfiguration::Array::MockClass.configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
56
145
  CascadingConfiguration::Array::MockClass.configuration_setting.push( :a_yet_unused_configuration )
57
- CascadingConfiguration::Array::MockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration ]
58
- object_instance_one.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :some_other_configuration ]
59
- CascadingConfiguration::Array::MockClassSub1.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration ]
60
- object_instance_two.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
146
+ CascadingConfiguration::Array::MockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
147
+ object_instance_one.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
148
+ CascadingConfiguration::Array::MockClassSub1.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
149
+ object_instance_two.configuration_setting.should == [ :a_yet_unused_configuration, :some_other_configuration ]
61
150
 
62
151
  # freeze ancestor setting
63
152
  object_instance_one.configuration_setting.freeze!
64
- object_instance_one.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :some_other_configuration ]
153
+ object_instance_one.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
65
154
  CascadingConfiguration::Array::MockClassSub1.configuration_setting.freeze!
66
- CascadingConfiguration::Array::MockClassSub1.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration ]
155
+ CascadingConfiguration::Array::MockClassSub1.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
67
156
  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
- object_instance_one.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :some_other_configuration ]
70
- CascadingConfiguration::Array::MockClassSub1.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration ]
71
- object_instance_two.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
72
-
73
- # test two
74
-
75
- module CascadingConfiguration::Array::MockModuleExtended
76
- include CascadingConfiguration::Array
77
- attr_configuration_array :configuration_setting
78
- configuration_setting.should == []
79
- configuration_setting.push( :a_configuration )
80
- configuration_setting.should == [ :a_configuration ]
81
- end
82
-
83
- class CascadingConfiguration::Array::MockClassExtended
84
- extend CascadingConfiguration::Array::MockModuleExtended
85
- configuration_setting.should == [ :a_configuration ]
86
- end
87
-
157
+ CascadingConfiguration::Array::MockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :non_cascading_configuration, :some_other_configuration ]
158
+ object_instance_one.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
159
+ CascadingConfiguration::Array::MockClassSub1.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
160
+ object_instance_two.configuration_setting.should == [ :a_yet_unused_configuration, :some_other_configuration ]
161
+
88
162
  end
89
163
 
90
164
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 1
8
- - 5
9
- version: 1.1.5
8
+ - 6
9
+ version: 1.1.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Asher
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-07-18 00:00:00 -04:00
17
+ date: 2011-07-19 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -41,15 +41,15 @@ extra_rdoc_files: []
41
41
  files:
42
42
  - lib/cascading-configuration-array/CascadingConfiguration/_private_/CompositingArray.rb
43
43
  - lib/cascading-configuration-array/CascadingConfiguration/_private_/LocalConfigurationArray.rb
44
- - lib/cascading-configuration-array/CascadingConfiguration/Array/Accessors.rb
45
- - lib/cascading-configuration-array/CascadingConfiguration/Array/ClassInstance.rb
46
- - lib/cascading-configuration-array/CascadingConfiguration/Array/ModuleInstance.rb
44
+ - lib/cascading-configuration-array/CascadingConfiguration/Array/ConfigurationAccessors.rb
45
+ - lib/cascading-configuration-array/CascadingConfiguration/Array/Interface.rb
46
+ - lib/cascading-configuration-array/CascadingConfiguration/Array/ModuleInclusionExtensionSupport.rb
47
47
  - lib/cascading-configuration-array/CascadingConfiguration/Array.rb
48
48
  - lib/cascading-configuration-array/CascadingConfiguration/CompositingArray/Instance.rb
49
49
  - lib/cascading-configuration-array/CascadingConfiguration/CompositingArray.rb
50
50
  - lib/cascading-configuration-array/CascadingConfiguration/LocalConfigurationArray.rb
51
51
  - lib/cascading-configuration-array.rb
52
- - spec/CascadingConfiguration/Array/Accessors_spec.rb
52
+ - spec/CascadingConfiguration/Array/ConfigurationAccessors_spec.rb
53
53
  - spec/CascadingConfiguration/Array_spec.rb
54
54
  - spec/CascadingConfiguration/CompositingArray_spec.rb
55
55
  - spec/CascadingConfiguration/LocalConfigurationArray_spec.rb
@@ -1,38 +0,0 @@
1
-
2
- module CascadingConfiguration::Array::Accessors
3
-
4
- extend CascadingConfiguration::InternalModuleStub
5
-
6
- ###################################
7
- # define_cascading_array_setter #
8
- ###################################
9
-
10
- def define_cascading_array_setter( configuration_name )
11
- configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
12
- self::AccessorSupportModule.module_eval do
13
- define_method( configuration_setter_name ) do |array|
14
- composite_array = composite_array_for_cascading_configuration( configuration_name )
15
- # we want the array to supplant existing config
16
- # clear the array (excludes everything explicitly)
17
- composite_array.clear
18
- # push array elements (removes anything excluded from exclude)
19
- composite_array.push( *array )
20
- return composite_array
21
- end
22
- end
23
- end
24
-
25
- ###################################
26
- # define_cascading_array_getter #
27
- ###################################
28
-
29
- def define_cascading_array_getter( configuration_name )
30
- configuration_getter_name = configuration_name
31
- self::AccessorSupportModule.module_eval do
32
- define_method( configuration_getter_name ) do
33
- return composite_array_for_cascading_configuration( configuration_name )
34
- end
35
- end
36
- end
37
-
38
- end
@@ -1,19 +0,0 @@
1
-
2
- module CascadingConfiguration::Array::ClassInstance
3
-
4
- extend CascadingConfiguration::InternalModuleStub
5
-
6
- ##############################
7
- # attr_configuration_array #
8
- ##############################
9
-
10
- def attr_configuration_array( *property_names )
11
- property_names.each do |this_property_name|
12
- # define configuration setter
13
- define_cascading_array_setter( this_property_name )
14
- # define configuration getter
15
- define_cascading_array_getter( this_property_name )
16
- end
17
- end
18
-
19
- end
@@ -1,34 +0,0 @@
1
-
2
- module CascadingConfiguration::Array::ModuleInstance
3
-
4
- extend CascadingConfiguration::InternalModuleStub
5
-
6
- ##############
7
- # included #
8
- ##############
9
-
10
- def included( class_or_module )
11
- super if method_defined?( :super )
12
- # CascadingConfiguration::Array
13
- module_self = self
14
- class_or_module.instance_eval do
15
- # cascade CascadingConfiguration::Array
16
- include CascadingConfiguration::Array
17
- end
18
- end
19
-
20
- ##############
21
- # extended #
22
- ##############
23
-
24
- def extended( class_or_module )
25
- super if method_defined?( :super )
26
- # CascadingConfiguration::Array
27
- module_self = self
28
- class_or_module.instance_eval do
29
- # cascade CascadingConfiguration::Array
30
- include CascadingConfiguration::Array
31
- end
32
- end
33
-
34
- end