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