cascading-configuration-array-sorted-unique 2.1.6 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,19 @@
1
+
2
+ == 2/23/2012
3
+
4
+ Created from default behavior for CascadingConfiguration::Array as sorted, unique.
5
+
6
+ == 3/4/2012
7
+
8
+ Significantly reduced redundant code.
9
+ Added accessor-utilities support, meaning now configurations can be named with ? at the end, which creates :method? and :method=".
10
+
11
+ == 3/18/2012
12
+
13
+ Method definition moved to ::CascadingConfiguration::Methods based on configuration method. Less source code to maintain, and easier to add further modules!
14
+ CompositingArray moved to independent gem (compositing-array).
15
+ Added compositing object extension support - pass in a module or use a block to define a module or both.
16
+
17
+ == 6/18/2012
18
+
19
+ Merged into cascading-configuration.
data/README.md CHANGED
@@ -4,201 +4,16 @@ http://rubygems.org/gems/cascading-configuration-array
4
4
 
5
5
  # Description #
6
6
 
7
- Adds methods for cascading configuration arrays. Support package for cascading-configuration.
7
+ Now just a thin wrapper for cascading-configuration.
8
8
 
9
9
  # Summary #
10
10
 
11
- Cascading configuration methods for arrays, which returns the appropriate lowest accumulated value. Configuration inheritance can cascade through modules, classes, and to instances.
12
-
13
- This means that we can create configuration modules, optionally setting configuration defaults, and include those configuration modules in other modules or classes.
11
+ Deprecated.
14
12
 
15
13
  # Install #
16
14
 
17
15
  * sudo gem install cascading-configuration
18
16
 
19
- # Usage #
20
-
21
- Including the module will enable support for singleton and for instances.
22
-
23
- ```ruby
24
- module AnyModuleOrClass
25
- include CascadingConfiguration
26
- end
27
- ```
28
-
29
- Extending the module will enable support for singleton only.
30
-
31
- ```ruby
32
- module AnyModuleOrClass
33
- extend CascadingConfiguration
34
- end
35
- ```
36
-
37
- Including or extending CascadingConfiguration includes or extends:
38
-
39
- * CascadingConfiguration::Variable
40
-
41
- ## :attr_configuration_sorted_unique_array ##
42
-
43
- :attr_configuration_sorted_unique_array provides inheritable array configurations that cascade downward. A composite sorted and unique array will be returned (merging downward from most distant ancestor to self).
44
-
45
- An internal cache is kept, and any configuration updates that occur to higher-level ancestors cascade immediately downward.
46
-
47
- The array maintained by :attr_configuration_sorted_unique_array is kept ordered and unique.
48
-
49
- Define initial configuration in a module or class:
50
-
51
- ```ruby
52
- module SomeModule
53
-
54
- include CascadingConfiguration::Array
55
-
56
- attr_array_configuration :some_array_setting
57
-
58
- some_array_setting # => nil
59
-
60
- some_array_setting.push( :some_value )
61
-
62
- some_array_setting # => [ :some_value ]
63
-
64
- end
65
- ```
66
-
67
- Include initial module in a module or class:
68
-
69
- ```ruby
70
- class SomeClass
71
-
72
- include SomeModule
73
-
74
- some_array_setting # => [ :some_value ]
75
-
76
- self.some_array_setting = [ :some_other_value ]
77
-
78
- some_array_setting # => [ :some_other_value ]
79
-
80
- some_array_setting.push( :another_value ) # => [ :another_value, :some_other_value ]
81
-
82
- SomeModule.some_array_setting # => [ :some_value ]
83
-
84
- end
85
- ```
86
-
87
- And it cascades to instances:
88
-
89
- ```ruby
90
- instance = SomeClass.new
91
-
92
- instance.some_array_setting.should == [ :another_value, :some_other_value ]
93
-
94
- instance.some_array_setting.delete( :some_other_value )
95
-
96
- instance.some_array_setting.should == [ :another_value ]
97
- ```
98
-
99
- ### :attr_module_configuration_sorted_unique_array, :attr_class_configuration_sorted_unique_array ###
100
-
101
- :attr_class_configuration_sorted_unique_array works like :attr_configuration_sorted_unique_array but does not cascade to instances.
102
-
103
- ```ruby
104
- module SomeModule
105
-
106
- include CascadingConfiguration::Array
107
-
108
- attr_array_configuration :some_array_setting
109
-
110
- some_array_setting # => nil
111
-
112
- some_array_setting.push( :some_value )
113
-
114
- some_array_setting # => [ :some_value ]
115
-
116
- end
117
- ```
118
-
119
- Include initial module in a module or class:
120
-
121
- ```ruby
122
- class SomeClass
123
-
124
- include SomeModule
125
-
126
- some_array_setting # => [ :some_value ]
127
-
128
- self.some_array_setting = [ :some_other_value ]
129
-
130
- some_array_setting # => [ :some_other_value ]
131
-
132
- some_array_setting.push( :another_value ) # => [ :another_value, :some_other_value ]
133
-
134
- SomeModule.some_array_setting # => [ :some_value ]
135
-
136
- end
137
- ```
138
-
139
- And it does not cascade to instances:
140
-
141
- ```ruby
142
- instance = SomeClass.new
143
-
144
- instance.respond_to?( :some_array_setting ).should == false
145
- ```
146
-
147
- ### :attr_local_configuration_sorted_unique_array ###
148
-
149
- :attr_local_configuration_sorted_unique_array works like :attr_configuration_sorted_unique_array but does not cascade. This is primarily useful for creating local configurations maintained in parallel with cascading configurations (for instance, with the same variable prefixes), for overriding the local configuration method, and for hiding the configuration variable (coming soon).
150
-
151
- ```ruby
152
- module SomeModule
153
-
154
- include CascadingConfiguration::Array
155
-
156
- attr_array_configuration :some_array_setting
157
-
158
- some_array_setting # => nil
159
-
160
- some_array_setting.push( :some_value )
161
-
162
- some_array_setting # => [ :some_value ]
163
-
164
- end
165
- ```
166
-
167
- Include initial module in a module or class:
168
-
169
- ```ruby
170
- class SomeClass
171
-
172
- include SomeModule
173
-
174
- respond_to?( :some_array_setting ).should == false
175
-
176
- end
177
- ```
178
-
179
- ## Additional Functionality ##
180
-
181
- Cascading-configuration also provides several other convenience functions.
182
-
183
- ### Method Redefinition ###
184
-
185
- Any declared configuration is defined in order to support locally redefining the method and accessing the original by calling super.
186
-
187
- ```ruby
188
- module SomeModule
189
-
190
- include CascadingConfiguration
191
-
192
- attr_configuration :some_array_setting
193
-
194
- def some_array_setting=( value )
195
- puts 'Replacing configuration array!'
196
- super
197
- end
198
-
199
- end
200
- ```
201
-
202
17
  # License #
203
18
 
204
19
  (The MIT License)
@@ -4,34 +4,16 @@ http://rubygems.org/gems/cascading-configuration-array
4
4
 
5
5
  == Description
6
6
 
7
- Adds methods for cascading configuration arrays. Support package for cascading-configuration.
7
+ Now just a thin wrapper for cascading-configuration.
8
8
 
9
9
  == Summary
10
10
 
11
- Cascading configuration methods for arrays, which returns the appropriate lowest accumulated value. Configuration inheritance can cascade through modules, classes, and to instances.
12
-
13
- This means that we can create configuration modules, optionally setting configuration defaults, and include those configuration modules in other modules or classes.
14
-
15
- == :attr_configuration_sorted_unique_array
16
-
17
- :attr_configuration_sorted_unique_array provides inheritable array configurations that cascade downward. A composite sorted and unique array will be returned (merging downward from most distant ancestor to self).
18
-
19
- An internal cache is kept, and any configuration updates that occur to higher-level ancestors cascade immediately downward.
20
-
21
- The array maintained by :attr_configuration_sorted_unique_array is kept ordered and unique.
22
-
23
- :attr_class_configuration_sorted_unique_array works like :attr_configuration_sorted_unique_array but does not cascade to instances.
24
-
25
- :attr_local_configuration_sorted_unique_array works like :attr_configuration_sorted_unique_array but does not cascade. This is primarily useful for creating local configurations maintained in parallel with cascading configurations (for instance, with the same variable prefixes), for overriding the local configuration method, and for hiding the configuration variable (coming soon).
11
+ Deprecated.
26
12
 
27
13
  == Install
28
14
 
29
15
  * sudo gem install cascading-configuration
30
16
 
31
- == Usage
32
-
33
- See README.md
34
-
35
17
  == License
36
18
 
37
19
  (The MIT License)
@@ -1,21 +1,2 @@
1
1
 
2
- require 'compositing-array-sorted-unique'
3
-
4
- if $__cascading_configuration__spec__development
5
- require_relative '../../definition/lib/cascading-configuration-definition.rb'
6
- else
7
- require 'cascading-configuration-definition'
8
- end
9
-
10
- module ::CascadingConfiguration
11
- module Array
12
- module Sorted
13
- module Unique
14
- end
15
- end
16
- end
17
- end
18
-
19
- require_relative 'cascading-configuration-array-sorted-unique/CascadingConfiguration/Array/Sorted/Unique.rb'
20
-
21
-
2
+ require 'cascading-configuration'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cascading-configuration-array-sorted-unique
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.6
4
+ version: 3.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-23 00:00:00.000000000 Z
12
+ date: 2012-06-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: cascading-configuration-array-sorted
16
- requirement: &70193146161640 !ruby/object:Gem::Requirement
15
+ name: cascading-configuration
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,30 +21,23 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70193146161640
25
- - !ruby/object:Gem::Dependency
26
- name: cascading-configuration-array-unique
27
- requirement: &70193146158900 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
28
25
  none: false
29
26
  requirements:
30
27
  - - ! '>='
31
28
  - !ruby/object:Gem::Version
32
29
  version: '0'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: *70193146158900
36
- description: Provides :attr_configuration_unique_sorted_array.
30
+ description: Now just a thin wrapper for cascading-configuration.
37
31
  email: asher@ridiculouspower.com
38
32
  executables: []
39
33
  extensions: []
40
34
  extra_rdoc_files: []
41
35
  files:
42
- - lib/cascading-configuration-array-sorted-unique/CascadingConfiguration/Array/Sorted/Unique.rb
43
36
  - lib/cascading-configuration-array-sorted-unique.rb
44
- - spec/CascadingConfiguration/Array/Sorted/Unique_spec.rb
45
37
  - README.md
46
38
  - README.rdoc
47
- homepage: http://rubygems.org/gems/cascading-configuration-array-sorted-unique
39
+ - CHANGELOG.rdoc
40
+ homepage: http://rubygems.org/gems/cascading-configuration
48
41
  licenses: []
49
42
  post_install_message:
50
43
  rdoc_options: []
@@ -64,8 +57,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
57
  version: '0'
65
58
  requirements: []
66
59
  rubyforge_project: cascading-configuration-array-sorted-unique
67
- rubygems_version: 1.8.11
60
+ rubygems_version: 1.8.23
68
61
  signing_key:
69
62
  specification_version: 3
70
- summary: Support package for cascading-configuration.
63
+ summary: Deprecated.
71
64
  test_files: []
65
+ has_rdoc:
@@ -1,31 +0,0 @@
1
-
2
- module ::CascadingConfiguration::Array::Sorted::Unique
3
-
4
- # Configuration modules for storage of settings arrays
5
- include ::CascadingConfiguration::Inheritance
6
-
7
- #####################################################
8
- # attr_configuration_sorted_unique_array #
9
- # attr_module_configuration_sorted_unique_array #
10
- # attr_local_configuration_sorted_unique_array #
11
- # attr_object_configuration_sorted_unique_array #
12
- # attr_instance_configuration_sorted_unique_array #
13
- #####################################################
14
-
15
- def attr_configuration_sorted_unique_array( *configuration_names, & define_block ) ;; end
16
- def attr_module_configuration_sorted_unique_array( *configuration_names, & define_block ) ;; end
17
- def attr_class_configuration_sorted_unique_array( *configuration_names, & define_block ) ;; end
18
- def attr_local_configuration_sorted_unique_array( *configuration_names, & define_block ) ;; end
19
- def attr_object_configuration_sorted_unique_array( *configuration_names, & define_block ) ;; end
20
- def attr_instance_configuration_sorted_unique_array( *configuration_names, & define_block ) ;; end
21
-
22
- ccd = ::CascadingConfiguration::Definition
23
-
24
- ccd.declare_compositing_configuration_object( self,
25
- :sorted_unique_array,
26
- ::CompositingArray::Sorted::Unique )
27
-
28
- # To the tune of "The Events Leading Up to the Collapse of Detective Dulllight"
29
- # ~Oh where did all the code go? / Did you think that it'd stick around for-ever?~
30
-
31
- end
@@ -1,748 +0,0 @@
1
-
2
- if $__cascading_configuration__spec__development
3
- require_relative '../../../../lib/cascading-configuration-array-sorted-unique.rb'
4
- else
5
- require 'cascading-configuration-array-sorted-unique'
6
- end
7
-
8
- describe CascadingConfiguration::Array::Sorted::Unique do
9
-
10
- ############################################
11
- # attr_configuration_sorted_unique_array #
12
- ############################################
13
-
14
- it 'can define a configuration array, which is the primary interface' do
15
-
16
- # possibilities:
17
- # * module extended with setting
18
- # => singleton gets attr_configuration and configurations
19
- # => including modules and classes get nothing
20
- # => extending modules and classes get nothing
21
- # => instances of including and extending classes get nothing
22
- # * module included with setting
23
- # => singleton gets attr_configuration and configurations
24
- # => including modules and classes get attr_configuration and configurations
25
- # => instances of including classes get configurations
26
- # => extending modules and classes get attr_configuration and configurations
27
- # => instances of extending classes get nothing
28
- module ::CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleExtended
29
- extend CascadingConfiguration::Array::Sorted::Unique
30
- # => singleton gets attr_configuration and configurations
31
- respond_to?( :attr_configuration_sorted_unique_array ).should == true
32
- attr_configuration_sorted_unique_array :configuration_setting
33
- respond_to?( :configuration_setting ).should == true
34
- configuration_setting.should == []
35
- configuration_setting.push( :a_configuration )
36
- configuration_setting.should == [ :a_configuration ]
37
- instance_methods.include?( :configuration_setting ).should == false
38
- instance_variables.empty?.should == true
39
- # => including modules and classes get nothing
40
- module SubmoduleIncluding
41
- include CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleExtended
42
- instance_methods.include?( :configuration_setting ).should == false
43
- respond_to?( :configuration_setting ).should == false
44
- instance_variables.empty?.should == true
45
- end
46
- # => extending modules and classes get nothing
47
- module SubmoduleExtending
48
- extend CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleExtended
49
- instance_methods.include?( :configuration_setting ).should == false
50
- respond_to?( :configuration_setting ).should == false
51
- instance_variables.empty?.should == true
52
- end
53
- # => instances of including and extending classes get nothing
54
- class ClassIncluding
55
- include CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleExtended
56
- instance_methods.include?( :configuration_setting ).should == false
57
- respond_to?( :configuration_setting ).should == false
58
- instance_variables.empty?.should == true
59
- end
60
- class ClassExtending
61
- extend CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleExtended
62
- instance_methods.include?( :configuration_setting ).should == false
63
- respond_to?( :configuration_setting ).should == false
64
- instance_variables.empty?.should == true
65
- end
66
- end
67
-
68
- # * module included with setting
69
- module ::CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleIncluded
70
- include CascadingConfiguration::Array::Sorted::Unique
71
- # => singleton gets attr_configuration and configurations
72
- respond_to?( :attr_configuration_sorted_unique_array ).should == true
73
- attr_configuration_sorted_unique_array :configuration_setting
74
- respond_to?( :configuration_setting ).should == true
75
- configuration_setting.should == []
76
- configuration_setting.push( :a_configuration )
77
- configuration_setting.should == [ :a_configuration ]
78
- instance_methods.include?( :configuration_setting ).should == true
79
- instance_variables.empty?.should == true
80
- # => including modules and classes get attr_configuration and configurations
81
- module SubmoduleIncluding
82
- include CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleIncluded
83
- instance_methods.include?( :configuration_setting ).should == true
84
- respond_to?( :configuration_setting ).should == true
85
- configuration_setting.should == [ :a_configuration ]
86
- configuration_setting.push( :another_configuration )
87
- configuration_setting.should == [ :a_configuration, :another_configuration ]
88
- instance_variables.empty?.should == true
89
- end
90
- # => extending modules and classes get attr_configuration and configurations
91
- module SubmoduleExtending
92
- extend CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleIncluded
93
- # if we're extended then we want to use the eigenclass ancestor chain
94
- # - the first ancestor will be the extending module
95
- # - the rest of the ancestors will be the extending module's include chain
96
- respond_to?( :configuration_setting ).should == true
97
- configuration_setting.should == [ :a_configuration ]
98
- configuration_setting.push( :some_other_configuration )
99
- configuration_setting.should == [ :a_configuration, :some_other_configuration ]
100
- instance_methods.include?( :configuration_setting ).should == false
101
- instance_variables.empty?.should == true
102
- end
103
- # => instances of including classes get configurations
104
- class ClassIncluding
105
- include CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleIncluded
106
- instance_methods.include?( :configuration_setting ).should == true
107
- respond_to?( :configuration_setting ).should == true
108
- configuration_setting.should == [ :a_configuration ]
109
- configuration_setting.push( :some_other_configuration )
110
- configuration_setting.should == [ :a_configuration, :some_other_configuration ]
111
- instance_variables.empty?.should == true
112
- end
113
- setting_class_including_instance = ClassIncluding.new
114
- setting_class_including_instance.respond_to?( :configuration_setting ).should == true
115
- setting_class_including_instance.configuration_setting.should == [ :a_configuration, :some_other_configuration ]
116
- setting_class_including_instance.configuration_setting.delete( :some_other_configuration )
117
- setting_class_including_instance.configuration_setting = [ :our_setting_value ]
118
- setting_class_including_instance.configuration_setting.should == [ :our_setting_value ]
119
- setting_class_including_instance.instance_variables.empty?.should == true
120
- # => instances of extending classes get nothing
121
- class ClassExtending
122
- extend CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleIncluded
123
- respond_to?( :configuration_setting ).should == true
124
- configuration_setting.should == [ :a_configuration ]
125
- configuration_setting.push( :some_other_configuration )
126
- configuration_setting.should == [ :a_configuration, :some_other_configuration ]
127
- instance_variables.empty?.should == true
128
- end
129
- setting_class_including_instance = ClassExtending.new
130
- setting_class_including_instance.respond_to?( :configuration_setting ).should == false
131
- setting_class_including_instance.instance_variables.empty?.should == true
132
- end
133
-
134
- class CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass
135
- include CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleIncluded::SubmoduleIncluding
136
- configuration_setting.should == [ :a_configuration, :another_configuration ]
137
- configuration_setting.push( :some_other_configuration )
138
- configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
139
- instance_variables.empty?.should == true
140
- end
141
- object_instance_one = CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass.new
142
- object_instance_one.configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
143
- object_instance_one.configuration_setting.delete( :a_configuration )
144
- object_instance_one.configuration_setting.should == [ :another_configuration, :some_other_configuration ]
145
- object_instance_one.instance_variables.empty?.should == true
146
- class CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub1 < CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass
147
- configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
148
- configuration_setting.delete( :a_configuration )
149
- configuration_setting.should == [ :another_configuration, :some_other_configuration ]
150
- instance_variables.empty?.should == true
151
- end
152
- object_instance_two = CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub1.new
153
- object_instance_two.configuration_setting.should == [ :another_configuration, :some_other_configuration ]
154
- object_instance_two.configuration_setting.delete( :another_configuration )
155
- object_instance_two.configuration_setting.should == [ :some_other_configuration ]
156
- object_instance_two.instance_variables.empty?.should == true
157
- class CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub2 < CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub1
158
- configuration_setting.should == [ :another_configuration, :some_other_configuration ]
159
- configuration_setting.push( :yet_another_configuration )
160
- configuration_setting.should == [ :another_configuration, :some_other_configuration, :yet_another_configuration ]
161
- instance_variables.empty?.should == true
162
- end
163
-
164
- # change ancestor setting
165
- CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass.configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
166
- CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass.configuration_setting.push( :a_yet_unused_configuration )
167
- CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
168
- object_instance_one.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
169
- CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub1.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
170
- object_instance_two.configuration_setting.should == [ :a_yet_unused_configuration, :some_other_configuration ]
171
-
172
- # freeze ancestor setting
173
- object_instance_one.configuration_setting.freeze!
174
- object_instance_one.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
175
- CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub1.configuration_setting.freeze!
176
- CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub1.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
177
- CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass.configuration_setting.push( :non_cascading_configuration )
178
- CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :non_cascading_configuration, :some_other_configuration ]
179
- object_instance_one.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
180
- CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub1.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
181
- object_instance_two.configuration_setting.should == [ :a_yet_unused_configuration, :some_other_configuration ]
182
-
183
- end
184
-
185
- ###################################################
186
- # attr_module_configuration_sorted_unique_array #
187
- # attr_class_configuration_sorted_unique_array #
188
- ###################################################
189
-
190
- it 'can define a class configuration array, which will not cascade to instances' do
191
-
192
- # possibilities:
193
- # * module extended with setting
194
- # => singleton gets attr_configuration and configurations
195
- # => including modules and classes get nothing
196
- # => extending modules and classes get nothing
197
- # => instances of including and extending classes get nothing
198
- # * module included with setting
199
- # => singleton gets attr_configuration and configurations
200
- # => including modules and classes get attr_configuration and configurations
201
- # => instances of including classes get configurations
202
- # => extending modules and classes get attr_configuration and configurations
203
- # => instances of extending classes get nothing
204
- module ::CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleExtended
205
- extend CascadingConfiguration::Array::Sorted::Unique
206
- # => singleton gets attr_configuration and configurations
207
- respond_to?( :attr_module_configuration_sorted_unique_array ).should == true
208
- method( :attr_module_configuration_sorted_unique_array ).should == method( :attr_class_configuration_sorted_unique_array )
209
- attr_module_configuration_sorted_unique_array :configuration_setting
210
- respond_to?( :configuration_setting ).should == true
211
- configuration_setting.should == []
212
- configuration_setting.push( :a_configuration )
213
- configuration_setting.should == [ :a_configuration ]
214
- instance_methods.include?( :configuration_setting ).should == false
215
- instance_variables.empty?.should == true
216
- # => including modules and classes get nothing
217
- module SubmoduleIncluding
218
- include CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleExtended
219
- instance_methods.include?( :configuration_setting ).should == false
220
- respond_to?( :configuration_setting ).should == false
221
- instance_variables.empty?.should == true
222
- end
223
- # => extending modules and classes get nothing
224
- module SubmoduleExtending
225
- extend CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleExtended
226
- instance_methods.include?( :configuration_setting ).should == false
227
- respond_to?( :configuration_setting ).should == false
228
- instance_variables.empty?.should == true
229
- end
230
- # => instances of including and extending classes get nothing
231
- class ClassIncluding
232
- include CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleExtended
233
- instance_methods.include?( :configuration_setting ).should == false
234
- respond_to?( :configuration_setting ).should == false
235
- instance_variables.empty?.should == true
236
- end
237
- class ClassExtending
238
- extend CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleExtended
239
- instance_methods.include?( :configuration_setting ).should == false
240
- respond_to?( :configuration_setting ).should == false
241
- instance_variables.empty?.should == true
242
- end
243
- end
244
-
245
- # * module included with setting
246
- module ::CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleIncluded
247
- include CascadingConfiguration::Array::Sorted::Unique
248
- # => singleton gets attr_configuration and configurations
249
- respond_to?( :attr_module_configuration_sorted_unique_array ).should == true
250
- attr_module_configuration_sorted_unique_array :configuration_setting
251
- respond_to?( :configuration_setting ).should == true
252
- configuration_setting.should == []
253
- configuration_setting.push( :a_configuration )
254
- configuration_setting.should == [ :a_configuration ]
255
- instance_methods.include?( :configuration_setting ).should == false
256
- instance_variables.empty?.should == true
257
- # => including modules and classes get attr_configuration and configurations
258
- module SubmoduleIncluding
259
- include CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleIncluded
260
- instance_methods.include?( :configuration_setting ).should == false
261
- respond_to?( :configuration_setting ).should == true
262
- configuration_setting.should == [ :a_configuration ]
263
- configuration_setting.push( :another_configuration )
264
- configuration_setting.should == [ :a_configuration, :another_configuration ]
265
- instance_methods.include?( :configuration_setting ).should == false
266
- instance_variables.empty?.should == true
267
- end
268
- # => extending modules and classes get attr_configuration and configurations
269
- module SubmoduleExtending
270
- extend CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleIncluded
271
- # if we're extended then we want to use the eigenclass ancestor chain
272
- # - the first ancestor will be the extending module
273
- # - the rest of the ancestors will be the extending module's include chain
274
- respond_to?( :configuration_setting ).should == true
275
- configuration_setting.should == [ :a_configuration ]
276
- configuration_setting.push( :some_other_configuration )
277
- configuration_setting.should == [ :a_configuration, :some_other_configuration ]
278
- instance_methods.include?( :configuration_setting ).should == false
279
- instance_variables.empty?.should == true
280
- end
281
- # => instances of including classes get configurations
282
- class ClassIncluding
283
- include CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleIncluded
284
- instance_methods.include?( :configuration_setting ).should == false
285
- respond_to?( :configuration_setting ).should == true
286
- configuration_setting.should == [ :a_configuration ]
287
- configuration_setting.push( :some_other_configuration )
288
- configuration_setting.should == [ :a_configuration, :some_other_configuration ]
289
- instance_variables.empty?.should == true
290
- end
291
- setting_class_including_instance = ClassIncluding.new
292
- setting_class_including_instance.respond_to?( :configuration_setting ).should == false
293
- setting_class_including_instance.instance_variables.empty?.should == true
294
- # => instances of extending classes get nothing
295
- class ClassExtending
296
- extend CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleIncluded
297
- instance_methods.include?( :configuration_setting ).should == false
298
- respond_to?( :configuration_setting ).should == true
299
- configuration_setting.should == [ :a_configuration ]
300
- configuration_setting.push( :some_other_configuration )
301
- configuration_setting.should == [ :a_configuration, :some_other_configuration ]
302
- instance_variables.empty?.should == true
303
- end
304
- setting_class_including_instance = ClassExtending.new
305
- setting_class_including_instance.respond_to?( :configuration_setting ).should == false
306
- setting_class_including_instance.instance_variables.empty?.should == true
307
- end
308
-
309
- class CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass
310
- include CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleIncluded::SubmoduleIncluding
311
- instance_methods.include?( :configuration_setting ).should == false
312
- configuration_setting.should == [ :a_configuration, :another_configuration ]
313
- configuration_setting.push( :some_other_configuration )
314
- configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
315
- instance_variables.empty?.should == true
316
- end
317
- object_instance_one = CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass.new
318
- object_instance_one.respond_to?( :configuration_setting ).should == false
319
- object_instance_one.instance_variables.empty?.should == true
320
- class CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub1 < CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass
321
- instance_methods.include?( :configuration_setting ).should == false
322
- configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
323
- configuration_setting.delete( :a_configuration )
324
- configuration_setting.should == [ :another_configuration, :some_other_configuration ]
325
- instance_variables.empty?.should == true
326
- end
327
- object_instance_two = CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub1.new
328
- object_instance_two.respond_to?( :configuration_setting ).should == false
329
- object_instance_two.instance_variables.empty?.should == true
330
- class CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub2 < CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub1
331
- instance_methods.include?( :configuration_setting ).should == false
332
- configuration_setting.should == [ :another_configuration, :some_other_configuration ]
333
- configuration_setting.push( :yet_another_configuration )
334
- configuration_setting.should == [ :another_configuration, :some_other_configuration, :yet_another_configuration ]
335
- instance_variables.empty?.should == true
336
- end
337
-
338
- # change ancestor setting
339
- CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass.configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
340
- CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass.configuration_setting.push( :a_yet_unused_configuration )
341
- CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
342
- CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub1.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
343
-
344
- # freeze ancestor setting
345
- CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub1.configuration_setting.freeze!
346
- CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub1.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
347
- CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass.configuration_setting.push( :non_cascading_configuration )
348
- CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :non_cascading_configuration, :some_other_configuration ]
349
- CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub1.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
350
-
351
- end
352
-
353
- ##################################################
354
- # attr_local_configuration_sorted_unique_array #
355
- ##################################################
356
-
357
- it 'can define a local configuration array, which will not cascade' do
358
-
359
- # possibilities:
360
- # * module extended with setting
361
- # => singleton gets attr_configuration and configurations
362
- # => including modules and classes get nothing
363
- # => extending modules and classes get nothing
364
- # => instances of including and extending classes get nothing
365
- # * module included with setting
366
- # => singleton gets attr_configuration and configurations
367
- # => including modules and classes get attr_configuration and configurations
368
- # => instances of including classes get configurations
369
- # => extending modules and classes get attr_configuration and configurations
370
- # => instances of extending classes get nothing
371
- module ::CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleExtended
372
- extend CascadingConfiguration::Array::Sorted::Unique
373
- # => singleton gets attr_configuration and configurations
374
- respond_to?( :attr_local_configuration_sorted_unique_array ).should == true
375
- attr_local_configuration_sorted_unique_array :configuration_setting
376
- respond_to?( :configuration_setting ).should == true
377
- configuration_setting.should == []
378
- configuration_setting.push( :a_configuration )
379
- configuration_setting.should == [ :a_configuration ]
380
- instance_methods.include?( :configuration_setting ).should == false
381
- instance_variables.empty?.should == true
382
- # => including modules and classes get nothing
383
- module SubmoduleIncluding
384
- include CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleExtended
385
- instance_methods.include?( :configuration_setting ).should == false
386
- respond_to?( :configuration_setting ).should == false
387
- instance_variables.empty?.should == true
388
- end
389
- # => extending modules and classes get nothing
390
- module SubmoduleExtending
391
- extend CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleExtended
392
- instance_methods.include?( :configuration_setting ).should == false
393
- respond_to?( :configuration_setting ).should == false
394
- instance_variables.empty?.should == true
395
- end
396
- # => instances of including and extending classes get nothing
397
- class ClassIncluding
398
- include CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleExtended
399
- instance_methods.include?( :configuration_setting ).should == false
400
- respond_to?( :configuration_setting ).should == false
401
- instance_variables.empty?.should == true
402
- end
403
- class ClassExtending
404
- extend CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleExtended
405
- instance_methods.include?( :configuration_setting ).should == false
406
- respond_to?( :configuration_setting ).should == false
407
- instance_variables.empty?.should == true
408
- end
409
- end
410
-
411
- # * module included with setting
412
- module ::CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleIncluded
413
- include CascadingConfiguration::Array::Sorted::Unique
414
- # => singleton gets attr_configuration and configurations
415
- respond_to?( :attr_local_configuration_sorted_unique_array ).should == true
416
- attr_local_configuration_sorted_unique_array :configuration_setting
417
- respond_to?( :configuration_setting ).should == true
418
- configuration_setting.should == []
419
- configuration_setting.push( :a_configuration )
420
- configuration_setting.should == [ :a_configuration ]
421
- instance_methods.include?( :configuration_setting ).should == true
422
- instance_variables.empty?.should == true
423
- # => including modules and classes get attr_configuration and configurations
424
- module SubmoduleIncluding
425
- include CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleIncluded
426
- instance_methods.include?( :configuration_setting ).should == true
427
- respond_to?( :configuration_setting ).should == false
428
- instance_variables.empty?.should == true
429
- end
430
- # => extending modules and classes get attr_configuration and configurations
431
- module SubmoduleExtending
432
- extend CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleIncluded
433
- # if we're extended then we want to use the eigenclass ancestor chain
434
- # - the first ancestor will be the extending module
435
- # - the rest of the ancestors will be the extending module's include chain
436
- respond_to?( :configuration_setting ).should == true
437
- instance_methods.include?( :configuration_setting ).should == false
438
- instance_variables.empty?.should == true
439
- end
440
- # => instances of including classes get configurations
441
- class ClassIncluding
442
- include CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleIncluded
443
- instance_methods.include?( :configuration_setting ).should == true
444
- respond_to?( :configuration_setting ).should == false
445
- instance_variables.empty?.should == true
446
- end
447
- setting_class_including_instance = ClassIncluding.new
448
- setting_class_including_instance.respond_to?( :configuration_setting ).should == true
449
- setting_class_including_instance.instance_variables.empty?.should == true
450
- # => instances of extending classes get nothing
451
- class ClassExtending
452
- extend CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleIncluded
453
- instance_methods.include?( :configuration_setting ).should == false
454
- respond_to?( :configuration_setting ).should == true
455
- instance_variables.empty?.should == true
456
- end
457
- setting_class_including_instance = ClassExtending.new
458
- setting_class_including_instance.respond_to?( :configuration_setting ).should == false
459
- setting_class_including_instance.instance_variables.empty?.should == true
460
- end
461
-
462
- class CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockClass
463
- include CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleIncluded::SubmoduleIncluding
464
- instance_methods.include?( :configuration_setting ).should == true
465
- respond_to?( :configuration_setting ).should == false
466
- instance_variables.empty?.should == true
467
- end
468
- object_instance_one = CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockClass.new
469
- object_instance_one.respond_to?( :configuration_setting ).should == true
470
- object_instance_one.instance_variables.empty?.should == true
471
- class CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockClassSub1 < CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockClass
472
- instance_methods.include?( :configuration_setting ).should == true
473
- respond_to?( :configuration_setting ).should == false
474
- instance_variables.empty?.should == true
475
- end
476
- object_instance_two = CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockClassSub1.new
477
- object_instance_two.respond_to?( :configuration_setting ).should == true
478
- object_instance_two.instance_variables.empty?.should == true
479
- class CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockClassSub2 < CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockClassSub1
480
- instance_methods.include?( :configuration_setting ).should == true
481
- respond_to?( :configuration_setting ).should == false
482
- instance_variables.empty?.should == true
483
- end
484
-
485
- end
486
-
487
- #####################################################
488
- # attr_instance_configuration_sorted_unique_array #
489
- #####################################################
490
-
491
- it 'can define an instance configuration array, which will not cascade' do
492
-
493
- # possibilities:
494
- # * module extended with setting
495
- # => singleton gets attr_configuration and configurations
496
- # => including modules and classes get nothing
497
- # => extending modules and classes get nothing
498
- # => instances of including and extending classes get nothing
499
- # * module included with setting
500
- # => singleton gets attr_configuration and configurations
501
- # => including modules and classes get attr_configuration and configurations
502
- # => instances of including classes get configurations
503
- # => extending modules and classes get attr_configuration and configurations
504
- # => instances of extending classes get nothing
505
- module ::CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleExtended
506
- extend CascadingConfiguration::Array::Sorted::Unique
507
- # => singleton gets attr_configuration and configurations
508
- instance_variables.empty?.should == true
509
- # => including modules and classes get nothing
510
- module SubmoduleIncluding
511
- include CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleExtended
512
- instance_methods.include?( :configuration_setting ).should == false
513
- respond_to?( :configuration_setting ).should == false
514
- instance_variables.empty?.should == true
515
- end
516
- # => extending modules and classes get nothing
517
- module SubmoduleExtending
518
- extend CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleExtended
519
- instance_methods.include?( :configuration_setting ).should == false
520
- respond_to?( :configuration_setting ).should == false
521
- instance_variables.empty?.should == true
522
- end
523
- # => instances of including and extending classes get nothing
524
- class ClassIncluding
525
- include CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleExtended
526
- instance_methods.include?( :configuration_setting ).should == false
527
- respond_to?( :configuration_setting ).should == false
528
- instance_variables.empty?.should == true
529
- end
530
- class ClassExtending
531
- extend CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleExtended
532
- instance_methods.include?( :configuration_setting ).should == false
533
- respond_to?( :configuration_setting ).should == false
534
- instance_variables.empty?.should == true
535
- end
536
- end
537
-
538
- # * module included with setting
539
- module ::CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleIncluded
540
- include CascadingConfiguration::Array::Sorted::Unique
541
- # => singleton gets attr_configuration and configurations
542
- respond_to?( :attr_instance_configuration_sorted_unique_array ).should == true
543
- attr_instance_configuration_sorted_unique_array :configuration_setting
544
- respond_to?( :configuration_setting ).should == false
545
- instance_methods.include?( :configuration_setting ).should == true
546
- instance_variables.empty?.should == true
547
- # => including modules and classes get attr_configuration and configurations
548
- module SubmoduleIncluding
549
- include CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleIncluded
550
- instance_methods.include?( :configuration_setting ).should == true
551
- respond_to?( :configuration_setting ).should == false
552
- instance_methods.include?( :configuration_setting ).should == true
553
- instance_variables.empty?.should == true
554
- end
555
- # => extending modules and classes get attr_configuration and configurations
556
- module SubmoduleExtending
557
- extend CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleIncluded
558
- # if we're extended then we want to use the eigenclass ancestor chain
559
- # - the first ancestor will be the extending module
560
- # - the rest of the ancestors will be the extending module's include chain
561
- respond_to?( :configuration_setting ).should == true
562
- instance_methods.include?( :configuration_setting ).should == false
563
- instance_variables.empty?.should == true
564
- end
565
- # => instances of including classes get configurations
566
- class ClassIncluding
567
- include CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleIncluded
568
- instance_methods.include?( :configuration_setting ).should == true
569
- respond_to?( :configuration_setting ).should == false
570
- instance_variables.empty?.should == true
571
- end
572
- setting_class_including_instance = ClassIncluding.new
573
- setting_class_including_instance.respond_to?( :configuration_setting ).should == true
574
- setting_class_including_instance.instance_variables.empty?.should == true
575
- # => instances of extending classes get nothing
576
- class ClassExtending
577
- extend CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleIncluded
578
- instance_methods.include?( :configuration_setting ).should == false
579
- respond_to?( :configuration_setting ).should == true
580
- instance_variables.empty?.should == true
581
- end
582
- setting_class_including_instance = ClassExtending.new
583
- setting_class_including_instance.respond_to?( :configuration_setting ).should == false
584
- setting_class_including_instance.instance_variables.empty?.should == true
585
- end
586
-
587
- class CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockClass
588
- include CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleIncluded::SubmoduleIncluding
589
- instance_methods.include?( :configuration_setting ).should == true
590
- respond_to?( :configuration_setting ).should == false
591
- instance_variables.empty?.should == true
592
- end
593
- object_instance_one = CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockClass.new
594
- object_instance_one.respond_to?( :configuration_setting ).should == true
595
- object_instance_one.instance_variables.empty?.should == true
596
- class CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockClassSub1 < CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockClass
597
- instance_methods.include?( :configuration_setting ).should == true
598
- respond_to?( :configuration_setting ).should == false
599
- instance_variables.empty?.should == true
600
- end
601
- object_instance_two = CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockClassSub1.new
602
- object_instance_two.respond_to?( :configuration_setting ).should == true
603
- object_instance_two.instance_variables.empty?.should == true
604
- class CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockClassSub2 < CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockClassSub1
605
- instance_methods.include?( :configuration_setting ).should == true
606
- respond_to?( :configuration_setting ).should == false
607
- instance_variables.empty?.should == true
608
- end
609
-
610
- end
611
-
612
-
613
- ###################################################
614
- # attr_object_configuration_sorted_unique_array #
615
- ###################################################
616
-
617
- it 'can define an object configuration array, which will not cascade' do
618
-
619
- # possibilities:
620
- # * module extended with setting
621
- # => singleton gets attr_configuration and configurations
622
- # => including modules and classes get nothing
623
- # => extending modules and classes get nothing
624
- # => instances of including and extending classes get nothing
625
- # * module included with setting
626
- # => singleton gets attr_configuration and configurations
627
- # => including modules and classes get attr_configuration and configurations
628
- # => instances of including classes get configurations
629
- # => extending modules and classes get attr_configuration and configurations
630
- # => instances of extending classes get nothing
631
- module ::CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleExtended
632
- extend CascadingConfiguration::Array::Sorted::Unique
633
- # => singleton gets attr_configuration and configurations
634
- respond_to?( :attr_object_configuration_sorted_unique_array ).should == true
635
- attr_object_configuration_sorted_unique_array :configuration_setting
636
- respond_to?( :configuration_setting ).should == true
637
- configuration_setting.should == []
638
- configuration_setting.push( :a_configuration )
639
- configuration_setting.should == [ :a_configuration ]
640
- instance_methods.include?( :configuration_setting ).should == false
641
- instance_variables.empty?.should == true
642
- # => including modules and classes get nothing
643
- module SubmoduleIncluding
644
- include CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleExtended
645
- instance_methods.include?( :configuration_setting ).should == false
646
- respond_to?( :configuration_setting ).should == false
647
- instance_variables.empty?.should == true
648
- end
649
- # => extending modules and classes get nothing
650
- module SubmoduleExtending
651
- extend CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleExtended
652
- instance_methods.include?( :configuration_setting ).should == false
653
- respond_to?( :configuration_setting ).should == false
654
- instance_variables.empty?.should == true
655
- end
656
- # => instances of including and extending classes get nothing
657
- class ClassIncluding
658
- include CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleExtended
659
- instance_methods.include?( :configuration_setting ).should == false
660
- respond_to?( :configuration_setting ).should == false
661
- instance_variables.empty?.should == true
662
- end
663
- class ClassExtending
664
- extend CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleExtended
665
- instance_methods.include?( :configuration_setting ).should == false
666
- respond_to?( :configuration_setting ).should == false
667
- instance_variables.empty?.should == true
668
- end
669
- end
670
-
671
- # * module included with setting
672
- module ::CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleIncluded
673
- include CascadingConfiguration::Array::Sorted::Unique
674
- # => singleton gets attr_configuration and configurations
675
- respond_to?( :attr_object_configuration_sorted_unique_array ).should == true
676
- attr_object_configuration_sorted_unique_array :configuration_setting
677
- respond_to?( :configuration_setting ).should == true
678
- configuration_setting.should == []
679
- configuration_setting.push( :a_configuration )
680
- configuration_setting.should == [ :a_configuration ]
681
- instance_methods.include?( :configuration_setting ).should == false
682
- instance_variables.empty?.should == true
683
- # => including modules and classes get attr_configuration and configurations
684
- module SubmoduleIncluding
685
- include CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleIncluded
686
- instance_methods.include?( :configuration_setting ).should == false
687
- respond_to?( :configuration_setting ).should == false
688
- instance_methods.include?( :configuration_setting ).should == false
689
- instance_variables.empty?.should == true
690
- end
691
- # => extending modules and classes get attr_configuration and configurations
692
- module SubmoduleExtending
693
- extend CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleIncluded
694
- # if we're extended then we want to use the eigenclass ancestor chain
695
- # - the first ancestor will be the extending module
696
- # - the rest of the ancestors will be the extending module's include chain
697
- respond_to?( :configuration_setting ).should == false
698
- instance_methods.include?( :configuration_setting ).should == false
699
- instance_variables.empty?.should == true
700
- end
701
- # => instances of including classes get configurations
702
- class ClassIncluding
703
- include CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleIncluded
704
- instance_methods.include?( :configuration_setting ).should == false
705
- respond_to?( :configuration_setting ).should == false
706
- instance_variables.empty?.should == true
707
- end
708
- setting_class_including_instance = ClassIncluding.new
709
- setting_class_including_instance.respond_to?( :configuration_setting ).should == false
710
- setting_class_including_instance.instance_variables.empty?.should == true
711
- # => instances of extending classes get nothing
712
- class ClassExtending
713
- extend CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleIncluded
714
- instance_methods.include?( :configuration_setting ).should == false
715
- respond_to?( :configuration_setting ).should == false
716
- instance_variables.empty?.should == true
717
- end
718
- setting_class_including_instance = ClassExtending.new
719
- setting_class_including_instance.respond_to?( :configuration_setting ).should == false
720
- setting_class_including_instance.instance_variables.empty?.should == true
721
- end
722
-
723
- class CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockClass
724
- include CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleIncluded::SubmoduleIncluding
725
- instance_methods.include?( :configuration_setting ).should == false
726
- respond_to?( :configuration_setting ).should == false
727
- instance_variables.empty?.should == true
728
- end
729
- object_instance_one = CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockClass.new
730
- object_instance_one.respond_to?( :configuration_setting ).should == false
731
- object_instance_one.instance_variables.empty?.should == true
732
- class CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockClassSub1 < CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockClass
733
- instance_methods.include?( :configuration_setting ).should == false
734
- respond_to?( :configuration_setting ).should == false
735
- instance_variables.empty?.should == true
736
- end
737
- object_instance_two = CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockClassSub1.new
738
- object_instance_two.respond_to?( :configuration_setting ).should == false
739
- object_instance_two.instance_variables.empty?.should == true
740
- class CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockClassSub2 < CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockClassSub1
741
- instance_methods.include?( :configuration_setting ).should == false
742
- respond_to?( :configuration_setting ).should == false
743
- instance_variables.empty?.should == true
744
- end
745
-
746
- end
747
-
748
- end