cascading-configuration-array 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +312 -29
- data/README.rdoc +1 -25
- data/lib/cascading-configuration-array/CascadingConfiguration/Array/Accessors.rb +38 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/Array/ClassInstance.rb +19 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/Array/ModuleInstance.rb +34 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/Array.rb +24 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/CompositingArray/Instance.rb +39 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/CompositingArray.rb +216 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/LocalConfigurationArray.rb +166 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/_private_/CompositingArray.rb +57 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/_private_/LocalConfigurationArray.rb +26 -0
- data/lib/cascading-configuration-array.rb +35 -0
- data/spec/CascadingConfiguration/Array/Accessors_spec.rb +28 -0
- data/spec/CascadingConfiguration/Array_spec.rb +90 -0
- data/spec/CascadingConfiguration/CompositingArray_spec.rb +519 -0
- data/spec/CascadingConfiguration/LocalConfigurationArray_spec.rb +155 -0
- metadata +16 -5
- data/lib/cascading-configuration/CascadingConfiguration.rb +0 -16
- data/lib/cascading-configuration.rb +0 -15
- data/spec/CascadingConfiguration_spec.rb +0 -224
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 1.1.
|
8
|
+
- 5
|
9
|
+
version: 1.1.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Asher
|
@@ -39,9 +39,20 @@ extensions: []
|
|
39
39
|
extra_rdoc_files: []
|
40
40
|
|
41
41
|
files:
|
42
|
-
- lib/cascading-configuration/CascadingConfiguration.rb
|
43
|
-
- lib/cascading-configuration.rb
|
44
|
-
-
|
42
|
+
- lib/cascading-configuration-array/CascadingConfiguration/_private_/CompositingArray.rb
|
43
|
+
- lib/cascading-configuration-array/CascadingConfiguration/_private_/LocalConfigurationArray.rb
|
44
|
+
- lib/cascading-configuration-array/CascadingConfiguration/Array/Accessors.rb
|
45
|
+
- lib/cascading-configuration-array/CascadingConfiguration/Array/ClassInstance.rb
|
46
|
+
- lib/cascading-configuration-array/CascadingConfiguration/Array/ModuleInstance.rb
|
47
|
+
- lib/cascading-configuration-array/CascadingConfiguration/Array.rb
|
48
|
+
- lib/cascading-configuration-array/CascadingConfiguration/CompositingArray/Instance.rb
|
49
|
+
- lib/cascading-configuration-array/CascadingConfiguration/CompositingArray.rb
|
50
|
+
- lib/cascading-configuration-array/CascadingConfiguration/LocalConfigurationArray.rb
|
51
|
+
- lib/cascading-configuration-array.rb
|
52
|
+
- spec/CascadingConfiguration/Array/Accessors_spec.rb
|
53
|
+
- spec/CascadingConfiguration/Array_spec.rb
|
54
|
+
- spec/CascadingConfiguration/CompositingArray_spec.rb
|
55
|
+
- spec/CascadingConfiguration/LocalConfigurationArray_spec.rb
|
45
56
|
- README.md
|
46
57
|
- README.rdoc
|
47
58
|
has_rdoc: true
|
@@ -1,16 +0,0 @@
|
|
1
|
-
|
2
|
-
module CascadingConfiguration
|
3
|
-
|
4
|
-
###################
|
5
|
-
# self.included #
|
6
|
-
###################
|
7
|
-
|
8
|
-
def self.included( class_or_module )
|
9
|
-
class_or_module.instance_eval do
|
10
|
-
include CascadingConfiguration::Setting
|
11
|
-
include CascadingConfiguration::Array
|
12
|
-
include CascadingConfiguration::Hash
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
|
2
|
-
if $cascading_configuration_development
|
3
|
-
require_relative '../setting/lib/cascading-configuration-setting.rb'
|
4
|
-
require_relative '../settings-array/lib/cascading-configuration-array.rb'
|
5
|
-
require_relative '../settings-hash/lib/cascading-configuration-hash.rb'
|
6
|
-
else
|
7
|
-
require 'cascading-configuration-setting'
|
8
|
-
require 'cascading-configuration-array'
|
9
|
-
require 'cascading-configuration-hash'
|
10
|
-
end
|
11
|
-
|
12
|
-
module CascadingConfiguration
|
13
|
-
end
|
14
|
-
|
15
|
-
require_relative 'cascading-configuration/CascadingConfiguration.rb'
|
@@ -1,224 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative '../lib/cascading-configuration.rb'
|
3
|
-
|
4
|
-
describe CascadingConfiguration do
|
5
|
-
|
6
|
-
########################
|
7
|
-
# attr_configuration #
|
8
|
-
########################
|
9
|
-
|
10
|
-
it 'can declare an attribute as a cascading configuration setting' do
|
11
|
-
module CascadingConfiguration::MockModule2
|
12
|
-
end
|
13
|
-
|
14
|
-
# first module
|
15
|
-
module CascadingConfiguration::MockModule
|
16
|
-
include CascadingConfiguration
|
17
|
-
attr_configuration :some_configuration
|
18
|
-
self.some_configuration = :some_value
|
19
|
-
some_configuration.should == :some_value
|
20
|
-
end
|
21
|
-
|
22
|
-
# including module 1
|
23
|
-
module CascadingConfiguration::MockModule2
|
24
|
-
include CascadingConfiguration::MockModule
|
25
|
-
some_configuration.should == :some_value
|
26
|
-
self.some_configuration = :module_value
|
27
|
-
some_configuration.should == :module_value
|
28
|
-
end
|
29
|
-
|
30
|
-
# including module 2
|
31
|
-
module CascadingConfiguration::MockModule3
|
32
|
-
include CascadingConfiguration::MockModule2
|
33
|
-
end
|
34
|
-
|
35
|
-
# top class
|
36
|
-
class CascadingConfiguration::MockClass
|
37
|
-
include CascadingConfiguration::MockModule3
|
38
|
-
some_configuration.should == :module_value
|
39
|
-
self.some_configuration = :another_value
|
40
|
-
some_configuration.should == :another_value
|
41
|
-
end
|
42
|
-
|
43
|
-
# instance of top class
|
44
|
-
object_instance_one = CascadingConfiguration::MockClass.new
|
45
|
-
object_instance_one.some_configuration.should == :another_value
|
46
|
-
object_instance_one.some_configuration = :yet_another_value
|
47
|
-
object_instance_one.some_configuration.should == :yet_another_value
|
48
|
-
CascadingConfiguration::MockClass.some_configuration.should == :another_value
|
49
|
-
CascadingConfiguration::MockModule.some_configuration.should == :some_value
|
50
|
-
|
51
|
-
# first inheriting class
|
52
|
-
class CascadingConfiguration::MockClassSub1 < CascadingConfiguration::MockClass
|
53
|
-
some_configuration.should == :another_value
|
54
|
-
self.some_configuration = :a_value_not_yet_used
|
55
|
-
some_configuration.should == :a_value_not_yet_used
|
56
|
-
CascadingConfiguration::MockClass.some_configuration.should == :another_value
|
57
|
-
CascadingConfiguration::MockModule.some_configuration.should == :some_value
|
58
|
-
end
|
59
|
-
|
60
|
-
# Instance of First Inheriting Class
|
61
|
-
object_instance_two = CascadingConfiguration::MockClassSub1.new
|
62
|
-
object_instance_two.some_configuration.should == :a_value_not_yet_used
|
63
|
-
object_instance_one.some_configuration.should == :yet_another_value
|
64
|
-
CascadingConfiguration::MockClass.some_configuration.should == :another_value
|
65
|
-
CascadingConfiguration::MockModule.some_configuration.should == :some_value
|
66
|
-
|
67
|
-
# Second Inheriting Class
|
68
|
-
class CascadingConfiguration::MockClassSub2 < CascadingConfiguration::MockClassSub1
|
69
|
-
some_configuration.should == :a_value_not_yet_used
|
70
|
-
self.some_configuration = :another_value_not_yet_used
|
71
|
-
some_configuration.should == :another_value_not_yet_used
|
72
|
-
end
|
73
|
-
|
74
|
-
# Instance of Second Inheriting Class
|
75
|
-
object_instance_three = CascadingConfiguration::MockClassSub2.new
|
76
|
-
object_instance_three.some_configuration.should == :another_value_not_yet_used
|
77
|
-
object_instance_three.some_configuration = :one_more_unused_value
|
78
|
-
object_instance_three.some_configuration.should == :one_more_unused_value
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
##############################
|
83
|
-
# attr_configuration_array #
|
84
|
-
##############################
|
85
|
-
|
86
|
-
it 'can declare an attribute as a cascading configuration array' do
|
87
|
-
|
88
|
-
# first module
|
89
|
-
module CascadingConfiguration::MockModule
|
90
|
-
attr_configuration_array :some_array_configuration
|
91
|
-
self.some_array_configuration = [ :some_value ]
|
92
|
-
some_array_configuration.should == [ :some_value ]
|
93
|
-
end
|
94
|
-
|
95
|
-
# including module 1
|
96
|
-
module CascadingConfiguration::MockModule2
|
97
|
-
some_array_configuration.should == [ :some_value ]
|
98
|
-
self.some_array_configuration = [ :module_value ]
|
99
|
-
some_array_configuration.should == [ :module_value ]
|
100
|
-
end
|
101
|
-
|
102
|
-
# including module 2
|
103
|
-
module CascadingConfiguration::MockModule3
|
104
|
-
some_array_configuration.should == [ :module_value ]
|
105
|
-
end
|
106
|
-
|
107
|
-
# top class
|
108
|
-
class CascadingConfiguration::MockClass
|
109
|
-
some_array_configuration.should == [ :module_value ]
|
110
|
-
self.some_array_configuration = [ :another_value ]
|
111
|
-
some_array_configuration.should == [ :another_value ]
|
112
|
-
end
|
113
|
-
|
114
|
-
# instance of top class
|
115
|
-
object_instance_one = CascadingConfiguration::MockClass.new
|
116
|
-
object_instance_one.some_array_configuration.should == [ :another_value ]
|
117
|
-
object_instance_one.some_array_configuration = [ :yet_another_value ]
|
118
|
-
object_instance_one.some_array_configuration.should == [ :yet_another_value ]
|
119
|
-
CascadingConfiguration::MockClass.some_array_configuration.should == [ :another_value ]
|
120
|
-
CascadingConfiguration::MockModule.some_array_configuration.should == [ :some_value ]
|
121
|
-
|
122
|
-
# first inheriting class
|
123
|
-
class CascadingConfiguration::MockClassSub1 < CascadingConfiguration::MockClass
|
124
|
-
some_array_configuration.should == [ :another_value ]
|
125
|
-
self.some_array_configuration = [ :a_value_not_yet_used ]
|
126
|
-
some_array_configuration.should == [ :a_value_not_yet_used ]
|
127
|
-
CascadingConfiguration::MockClass.some_array_configuration.should == [ :another_value ]
|
128
|
-
CascadingConfiguration::MockModule.some_array_configuration.should == [ :some_value ]
|
129
|
-
end
|
130
|
-
|
131
|
-
# Instance of First Inheriting Class
|
132
|
-
object_instance_two = CascadingConfiguration::MockClassSub1.new
|
133
|
-
object_instance_two.some_array_configuration.should == [ :a_value_not_yet_used ]
|
134
|
-
object_instance_one.some_array_configuration.should == [ :yet_another_value ]
|
135
|
-
CascadingConfiguration::MockClass.some_array_configuration.should == [ :another_value ]
|
136
|
-
CascadingConfiguration::MockModule.some_array_configuration.should == [ :some_value ]
|
137
|
-
|
138
|
-
# Second Inheriting Class
|
139
|
-
class CascadingConfiguration::MockClassSub2 < CascadingConfiguration::MockClassSub1
|
140
|
-
some_array_configuration.should == [ :a_value_not_yet_used ]
|
141
|
-
self.some_array_configuration = [ :another_value_not_yet_used ]
|
142
|
-
some_array_configuration.should == [ :another_value_not_yet_used ]
|
143
|
-
end
|
144
|
-
|
145
|
-
# Instance of Second Inheriting Class
|
146
|
-
object_instance_three = CascadingConfiguration::MockClassSub2.new
|
147
|
-
object_instance_three.some_array_configuration.should == [ :another_value_not_yet_used ]
|
148
|
-
object_instance_three.some_array_configuration = [ :one_more_unused_value ]
|
149
|
-
object_instance_three.some_array_configuration.should == [ :one_more_unused_value ]
|
150
|
-
|
151
|
-
end
|
152
|
-
|
153
|
-
#############################
|
154
|
-
# attr_configuration_hash #
|
155
|
-
#############################
|
156
|
-
|
157
|
-
it 'can declare an attribute as a cascading configuration hash' do
|
158
|
-
|
159
|
-
# first module
|
160
|
-
module CascadingConfiguration::MockModule
|
161
|
-
attr_configuration_hash :some_hash_configuration
|
162
|
-
self.some_hash_configuration = { :some_value => :some_value }
|
163
|
-
some_hash_configuration.should == { :some_value => :some_value }
|
164
|
-
end
|
165
|
-
|
166
|
-
# including module 1
|
167
|
-
module CascadingConfiguration::MockModule2
|
168
|
-
some_hash_configuration.should == { :some_value => :some_value }
|
169
|
-
self.some_hash_configuration = { :module_value => :some_value }
|
170
|
-
some_hash_configuration.should == { :module_value => :some_value }
|
171
|
-
end
|
172
|
-
|
173
|
-
# including module 2
|
174
|
-
module CascadingConfiguration::MockModule3
|
175
|
-
|
176
|
-
end
|
177
|
-
|
178
|
-
# top class
|
179
|
-
class CascadingConfiguration::MockClass
|
180
|
-
some_hash_configuration.should == { :module_value => :some_value }
|
181
|
-
self.some_hash_configuration = { :another_value => :some_value }
|
182
|
-
some_hash_configuration.should == { :another_value => :some_value }
|
183
|
-
end
|
184
|
-
|
185
|
-
# instance of top class
|
186
|
-
object_instance_one = CascadingConfiguration::MockClass.new
|
187
|
-
object_instance_one.some_hash_configuration.should == { :another_value => :some_value }
|
188
|
-
object_instance_one.some_hash_configuration = { :yet_another_value => :some_value }
|
189
|
-
object_instance_one.some_hash_configuration.should == { :yet_another_value => :some_value }
|
190
|
-
CascadingConfiguration::MockClass.some_hash_configuration.should == { :another_value => :some_value }
|
191
|
-
CascadingConfiguration::MockModule.some_hash_configuration.should == { :some_value => :some_value }
|
192
|
-
|
193
|
-
# first inheriting class
|
194
|
-
class CascadingConfiguration::MockClassSub1 < CascadingConfiguration::MockClass
|
195
|
-
some_hash_configuration.should == { :another_value => :some_value }
|
196
|
-
self.some_hash_configuration = { :a_value_not_yet_used => :some_value }
|
197
|
-
some_hash_configuration.should == { :a_value_not_yet_used => :some_value }
|
198
|
-
CascadingConfiguration::MockClass.some_hash_configuration.should == { :another_value => :some_value }
|
199
|
-
CascadingConfiguration::MockModule.some_hash_configuration.should == { :some_value => :some_value }
|
200
|
-
end
|
201
|
-
|
202
|
-
# Instance of First Inheriting Class
|
203
|
-
object_instance_two = CascadingConfiguration::MockClassSub1.new
|
204
|
-
object_instance_two.some_hash_configuration.should == { :a_value_not_yet_used => :some_value }
|
205
|
-
object_instance_one.some_hash_configuration.should == { :yet_another_value => :some_value }
|
206
|
-
CascadingConfiguration::MockClass.some_hash_configuration.should == { :another_value => :some_value }
|
207
|
-
CascadingConfiguration::MockModule.some_hash_configuration.should == { :some_value => :some_value }
|
208
|
-
|
209
|
-
# Second Inheriting Class
|
210
|
-
class CascadingConfiguration::MockClassSub2 < CascadingConfiguration::MockClassSub1
|
211
|
-
some_hash_configuration.should == { :a_value_not_yet_used => :some_value }
|
212
|
-
self.some_hash_configuration = { :another_value_not_yet_used => :some_value }
|
213
|
-
some_hash_configuration.should == { :another_value_not_yet_used => :some_value }
|
214
|
-
end
|
215
|
-
|
216
|
-
# Instance of Second Inheriting Class
|
217
|
-
object_instance_three = CascadingConfiguration::MockClassSub2.new
|
218
|
-
object_instance_three.some_hash_configuration.should == { :another_value_not_yet_used => :some_value }
|
219
|
-
object_instance_three.some_hash_configuration = { :one_more_unused_value => :some_value }
|
220
|
-
object_instance_three.some_hash_configuration.should == { :one_more_unused_value => :some_value }
|
221
|
-
|
222
|
-
end
|
223
|
-
|
224
|
-
end
|