cascading-configuration-hash 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +365 -0
- data/README.rdoc +14 -100
- data/lib/cascading-configuration-hash.rb +18 -15
- data/lib/cascading-configuration-hash/CascadingConfiguration/{CascadingCompositeHash.rb → CompositingHash.rb} +3 -3
- data/lib/cascading-configuration-hash/CascadingConfiguration/{CascadingCompositeHash → CompositingHash}/Instance.rb +4 -2
- data/lib/cascading-configuration-hash/CascadingConfiguration/{CascadingCompositeHash → CompositingHash}/_private_/Instance.rb +1 -1
- data/lib/cascading-configuration-hash/CascadingConfiguration/Hash.rb +33 -0
- data/lib/cascading-configuration-hash/CascadingConfiguration/Hash/Accessors.rb +49 -0
- data/lib/cascading-configuration-hash/CascadingConfiguration/{ConfigurationSettingsHash → Hash}/ClassInstance.rb +3 -1
- data/lib/cascading-configuration-hash/CascadingConfiguration/{ConfigurationSettingsHash → Hash}/ModuleInstance.rb +7 -4
- data/lib/cascading-configuration-hash/CascadingConfiguration/{ConfigurationHash.rb → LocalConfigurationHash.rb} +2 -2
- data/lib/cascading-configuration-hash/CascadingConfiguration/_private_/{CascadingCompositeHash.rb → CompositingHash.rb} +1 -1
- data/lib/cascading-configuration-hash/CascadingConfiguration/_private_/{ConfigurationHash.rb → LocalConfigurationHash.rb} +3 -3
- data/spec/CascadingConfiguration/CascadingCompositeHash_spec.rb +57 -57
- data/spec/CascadingConfiguration/ConfigurationHash_spec.rb +8 -8
- data/spec/CascadingConfiguration/ConfigurationSettingsHash/Accessors_spec.rb +12 -12
- data/spec/CascadingConfiguration/ConfigurationSettingsHash_spec.rb +21 -21
- metadata +14 -13
- data/lib/cascading-configuration-hash/CascadingConfiguration/ConfigurationSettingsHash.rb +0 -21
- data/lib/cascading-configuration-hash/CascadingConfiguration/ConfigurationSettingsHash/Accessors.rb +0 -35
@@ -1,15 +1,18 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
2
|
+
if $cascading_configuration_development
|
3
|
+
require_relative '../../variable/lib/cascading-configuration-variable.rb'
|
4
|
+
else
|
5
|
+
require 'cascading-configuration-variable'
|
6
|
+
end
|
4
7
|
|
5
8
|
module CascadingConfiguration
|
6
|
-
class
|
9
|
+
class CompositingHash < Hash
|
7
10
|
module Instance
|
8
11
|
end
|
9
12
|
end
|
10
|
-
class
|
13
|
+
class LocalConfigurationHash < Hash
|
11
14
|
end
|
12
|
-
module
|
15
|
+
module Hash
|
13
16
|
module Accessors
|
14
17
|
end
|
15
18
|
module ClassInstance
|
@@ -21,13 +24,13 @@ module CascadingConfiguration
|
|
21
24
|
end
|
22
25
|
end
|
23
26
|
|
24
|
-
require_relative 'cascading-configuration-hash/CascadingConfiguration/
|
25
|
-
require_relative 'cascading-configuration-hash/CascadingConfiguration/_private_/
|
26
|
-
require_relative 'cascading-configuration-hash/CascadingConfiguration/
|
27
|
-
require_relative 'cascading-configuration-hash/CascadingConfiguration/
|
28
|
-
require_relative 'cascading-configuration-hash/CascadingConfiguration/
|
29
|
-
require_relative 'cascading-configuration-hash/CascadingConfiguration/_private_/
|
30
|
-
require_relative 'cascading-configuration-hash/CascadingConfiguration/
|
31
|
-
require_relative 'cascading-configuration-hash/CascadingConfiguration/
|
32
|
-
require_relative 'cascading-configuration-hash/CascadingConfiguration/
|
33
|
-
require_relative 'cascading-configuration-hash/CascadingConfiguration/
|
27
|
+
require_relative 'cascading-configuration-hash/CascadingConfiguration/CompositingHash.rb'
|
28
|
+
require_relative 'cascading-configuration-hash/CascadingConfiguration/_private_/CompositingHash.rb'
|
29
|
+
require_relative 'cascading-configuration-hash/CascadingConfiguration/CompositingHash/Instance.rb'
|
30
|
+
require_relative 'cascading-configuration-hash/CascadingConfiguration/CompositingHash/_private_/Instance.rb'
|
31
|
+
require_relative 'cascading-configuration-hash/CascadingConfiguration/LocalConfigurationHash.rb'
|
32
|
+
require_relative 'cascading-configuration-hash/CascadingConfiguration/_private_/LocalConfigurationHash.rb'
|
33
|
+
require_relative 'cascading-configuration-hash/CascadingConfiguration/Hash.rb'
|
34
|
+
require_relative 'cascading-configuration-hash/CascadingConfiguration/Hash/Accessors.rb'
|
35
|
+
require_relative 'cascading-configuration-hash/CascadingConfiguration/Hash/ClassInstance.rb'
|
36
|
+
require_relative 'cascading-configuration-hash/CascadingConfiguration/Hash/ModuleInstance.rb'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
class CascadingConfiguration::
|
2
|
+
class CascadingConfiguration::CompositingHash < Hash
|
3
3
|
|
4
4
|
attr_accessor :working_instance, :local_cascading_hash
|
5
5
|
|
@@ -17,9 +17,9 @@ class CascadingConfiguration::CascadingCompositeHash < Hash
|
|
17
17
|
@parent_composite_hash.register_child_composite_hash( self )
|
18
18
|
end
|
19
19
|
# get local cascading array (not included in parent composite)
|
20
|
-
@local_cascading_hash = ::CascadingConfiguration::
|
20
|
+
@local_cascading_hash = ::CascadingConfiguration::LocalConfigurationHash.new
|
21
21
|
# we may later have our own child composites
|
22
|
-
@child_composite_hashes = Array.new
|
22
|
+
@child_composite_hashes = ::Array.new
|
23
23
|
# initialize self status for parent and local
|
24
24
|
update_self_as_cascading_composite
|
25
25
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
|
2
|
-
module CascadingConfiguration::
|
2
|
+
module CascadingConfiguration::CompositingHash::Instance
|
3
|
+
|
4
|
+
extend CascadingConfiguration::InternalModuleStub
|
3
5
|
|
4
6
|
###################
|
5
7
|
# self.included #
|
@@ -24,7 +26,7 @@ module CascadingConfiguration::CascadingCompositeHash::Instance
|
|
24
26
|
if instance_variable_defined?( composite_hash_variable )
|
25
27
|
composite_hash = instance_variable_get( composite_hash_variable )
|
26
28
|
else
|
27
|
-
composite_hash = ::CascadingConfiguration::
|
29
|
+
composite_hash = ::CascadingConfiguration::CompositingHash.new( configuration_name, self )
|
28
30
|
instance_variable_set( composite_hash_variable, composite_hash )
|
29
31
|
end
|
30
32
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
module CascadingConfiguration::
|
2
|
+
module CascadingConfiguration::CompositingHash::Instance
|
3
3
|
|
4
4
|
###########################################################################################################
|
5
5
|
private ###############################################################################################
|
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
module CascadingConfiguration::Hash
|
3
|
+
|
4
|
+
extend CascadingConfiguration::InternalModuleStub
|
5
|
+
|
6
|
+
###################
|
7
|
+
# self.included #
|
8
|
+
###################
|
9
|
+
|
10
|
+
def self.included( class_or_module )
|
11
|
+
module_self = self
|
12
|
+
class_or_module.instance_eval do
|
13
|
+
include CascadingConfiguration::Variable
|
14
|
+
extend module_self
|
15
|
+
extend CascadingConfiguration::Hash::Accessors
|
16
|
+
extend CascadingConfiguration::Hash::ClassInstance
|
17
|
+
include CascadingConfiguration::CompositingHash::Instance
|
18
|
+
# module support
|
19
|
+
unless class_or_module.is_a?( Class )
|
20
|
+
extend CascadingConfiguration::Hash::ModuleInstance
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
#########################
|
26
|
+
# ancestors_to_Object #
|
27
|
+
#########################
|
28
|
+
|
29
|
+
def ancestors_to_Object
|
30
|
+
return ancestors_to_class_or_module_interpolating_module_branches( Object, CascadingConfiguration::Hash::ModuleInstance )
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
module CascadingConfiguration::Hash::Accessors
|
3
|
+
|
4
|
+
extend CascadingConfiguration::InternalModuleStub
|
5
|
+
|
6
|
+
###################
|
7
|
+
# self.extended #
|
8
|
+
###################
|
9
|
+
|
10
|
+
def self.extended( class_or_module )
|
11
|
+
class_or_module.instance_eval do
|
12
|
+
# accessor support in module to permit method overriding with super
|
13
|
+
unless const_defined?( :AccessorSupportModule )
|
14
|
+
accessor_support_module = Module.new { extend CascadingConfiguration::InternalModuleStub }
|
15
|
+
const_set( :AccessorSupportModule, accessor_support_module )
|
16
|
+
include class_or_module::AccessorSupportModule
|
17
|
+
extend class_or_module::AccessorSupportModule
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
######################################
|
23
|
+
# define_configuration_hash_setter #
|
24
|
+
######################################
|
25
|
+
|
26
|
+
def define_configuration_hash_setter( configuration_name )
|
27
|
+
configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
|
28
|
+
self::AccessorSupportModule.module_eval do
|
29
|
+
define_method( configuration_setter_name ) do |hash|
|
30
|
+
# we want the hash to supplant existing config
|
31
|
+
return composite_hash_for_cascading_configuration( configuration_name ).replace( hash )
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
######################################
|
37
|
+
# define_configuration_hash_getter #
|
38
|
+
######################################
|
39
|
+
|
40
|
+
def define_configuration_hash_getter( configuration_name )
|
41
|
+
configuration_getter_name = configuration_name
|
42
|
+
self::AccessorSupportModule.module_eval do
|
43
|
+
define_method( configuration_getter_name ) do
|
44
|
+
return composite_hash_for_cascading_configuration( configuration_name )
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -1,19 +1,22 @@
|
|
1
1
|
|
2
|
-
module CascadingConfiguration::
|
2
|
+
module CascadingConfiguration::Hash::ModuleInstance
|
3
3
|
|
4
|
+
extend CascadingConfiguration::InternalModuleStub
|
5
|
+
|
4
6
|
##############
|
5
7
|
# included #
|
6
8
|
##############
|
7
9
|
|
8
10
|
def included( class_or_module )
|
9
|
-
|
11
|
+
super if method_defined?( :super )
|
12
|
+
module_self = self
|
10
13
|
class_or_module.instance_eval do
|
11
|
-
include CascadingConfiguration::
|
14
|
+
include CascadingConfiguration::Hash
|
12
15
|
# when we extend a module (which has happened if we got here)
|
13
16
|
# then we need to make sure when the module we are extending is included
|
14
17
|
# * CascadingConfiguration is included
|
15
18
|
# * the module we extended is used to extend the class/module that included
|
16
|
-
extend
|
19
|
+
extend module_self
|
17
20
|
end
|
18
21
|
end
|
19
22
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
class CascadingConfiguration::
|
2
|
+
class CascadingConfiguration::LocalConfigurationHash < Hash
|
3
3
|
|
4
4
|
attr_accessor :exclude_array
|
5
5
|
|
@@ -8,7 +8,7 @@ class CascadingConfiguration::ConfigurationHash < Hash
|
|
8
8
|
################
|
9
9
|
|
10
10
|
def initialize()
|
11
|
-
@exclude_array = Array.new
|
11
|
+
@exclude_array = ::Array.new
|
12
12
|
end
|
13
13
|
|
14
14
|
#########
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
class CascadingConfiguration::
|
2
|
+
class CascadingConfiguration::CompositingHash < Hash
|
3
3
|
|
4
4
|
###########################################################################################################
|
5
5
|
private ###############################################################################################
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
class CascadingConfiguration::
|
2
|
+
class CascadingConfiguration::LocalConfigurationHash < Hash
|
3
3
|
|
4
4
|
###########################################################################################################
|
5
5
|
private ###############################################################################################
|
@@ -10,7 +10,7 @@ class CascadingConfiguration::ConfigurationHash < Hash
|
|
10
10
|
##########################
|
11
11
|
|
12
12
|
def add_to_exclude_array( *elements )
|
13
|
-
@exclude_array ||= Array.new
|
13
|
+
@exclude_array ||= ::Array.new
|
14
14
|
@exclude_array += elements
|
15
15
|
@exclude_array.sort!.uniq!
|
16
16
|
end
|
@@ -24,7 +24,7 @@ class CascadingConfiguration::ConfigurationHash < Hash
|
|
24
24
|
@exclude_array -= elements
|
25
25
|
@exclude_array.sort!.uniq!
|
26
26
|
else
|
27
|
-
@exclude_array ||= Array.new
|
27
|
+
@exclude_array ||= ::Array.new
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
require_relative '../../lib/cascading-configuration-hash.rb'
|
3
3
|
|
4
|
-
describe CascadingConfiguration::
|
4
|
+
describe CascadingConfiguration::CompositingHash do
|
5
5
|
|
6
6
|
#########
|
7
7
|
# []= #
|
@@ -9,11 +9,11 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
9
9
|
|
10
10
|
it 'can add elements' do
|
11
11
|
# primary class
|
12
|
-
class CascadingConfiguration::
|
13
|
-
include CascadingConfiguration::
|
14
|
-
include CascadingConfiguration::
|
12
|
+
class CascadingConfiguration::CompositingHash::Mock01
|
13
|
+
include CascadingConfiguration::Variable
|
14
|
+
include CascadingConfiguration::CompositingHash::Instance
|
15
15
|
end
|
16
|
-
working_instance = CascadingConfiguration::
|
16
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock01
|
17
17
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
18
18
|
cascading_composite_hash[ :some_setting ] = :some_value
|
19
19
|
cascading_composite_hash.local_cascading_hash.should == { :some_setting => :some_value }
|
@@ -24,7 +24,7 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
24
24
|
cascading_composite_hash.should == { :some_setting => :some_value,
|
25
25
|
:other_setting => :some_value }
|
26
26
|
# instance
|
27
|
-
working_instance = CascadingConfiguration::
|
27
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock01.new
|
28
28
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
29
29
|
cascading_composite_hash.local_cascading_hash.should == {}
|
30
30
|
cascading_composite_hash.should == { :some_setting => :some_value,
|
@@ -35,9 +35,9 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
35
35
|
:other_setting => :some_value,
|
36
36
|
:another_setting => :some_value }
|
37
37
|
# inheriting class
|
38
|
-
class CascadingConfiguration::
|
38
|
+
class CascadingConfiguration::CompositingHash::Mock01sub1 < CascadingConfiguration::CompositingHash::Mock01
|
39
39
|
end
|
40
|
-
working_instance = CascadingConfiguration::
|
40
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock01sub1
|
41
41
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
42
42
|
cascading_composite_hash.local_cascading_hash.should == {}
|
43
43
|
cascading_composite_hash.should == { :some_setting => :some_value,
|
@@ -48,7 +48,7 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
48
48
|
:other_setting => :some_value,
|
49
49
|
:yet_another_setting => :some_value }
|
50
50
|
# instance
|
51
|
-
working_instance = CascadingConfiguration::
|
51
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock01sub1.new
|
52
52
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
53
53
|
cascading_composite_hash.local_cascading_hash.should == {}
|
54
54
|
cascading_composite_hash.should == { :some_setting => :some_value,
|
@@ -68,11 +68,11 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
68
68
|
|
69
69
|
it 'can add elements' do
|
70
70
|
# primary class
|
71
|
-
class CascadingConfiguration::
|
72
|
-
include CascadingConfiguration::
|
73
|
-
include CascadingConfiguration::
|
71
|
+
class CascadingConfiguration::CompositingHash::Mock02
|
72
|
+
include CascadingConfiguration::Variable
|
73
|
+
include CascadingConfiguration::CompositingHash::Instance
|
74
74
|
end
|
75
|
-
working_instance = CascadingConfiguration::
|
75
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock02
|
76
76
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
77
77
|
cascading_composite_hash.store( :some_setting, :some_value )
|
78
78
|
cascading_composite_hash.local_cascading_hash.should == { :some_setting => :some_value }
|
@@ -83,7 +83,7 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
83
83
|
cascading_composite_hash.should == { :some_setting => :some_value,
|
84
84
|
:other_setting => :some_value }
|
85
85
|
# instance
|
86
|
-
working_instance = CascadingConfiguration::
|
86
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock02.new
|
87
87
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
88
88
|
cascading_composite_hash.local_cascading_hash.should == {}
|
89
89
|
cascading_composite_hash.should == { :some_setting => :some_value,
|
@@ -94,9 +94,9 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
94
94
|
:other_setting => :some_value,
|
95
95
|
:another_setting => :some_value }
|
96
96
|
# inheriting class
|
97
|
-
class CascadingConfiguration::
|
97
|
+
class CascadingConfiguration::CompositingHash::Mock02sub1 < CascadingConfiguration::CompositingHash::Mock02
|
98
98
|
end
|
99
|
-
working_instance = CascadingConfiguration::
|
99
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock02sub1
|
100
100
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
101
101
|
cascading_composite_hash.local_cascading_hash.should == {}
|
102
102
|
cascading_composite_hash.should == { :some_setting => :some_value,
|
@@ -107,7 +107,7 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
107
107
|
:other_setting => :some_value,
|
108
108
|
:yet_another_setting => :some_value }
|
109
109
|
# instance
|
110
|
-
working_instance = CascadingConfiguration::
|
110
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock02sub1.new
|
111
111
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
112
112
|
cascading_composite_hash.local_cascading_hash.should == {}
|
113
113
|
cascading_composite_hash.should == { :some_setting => :some_value,
|
@@ -127,11 +127,11 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
127
127
|
|
128
128
|
it 'can exclude elements' do
|
129
129
|
# primary class
|
130
|
-
class CascadingConfiguration::
|
131
|
-
include CascadingConfiguration::
|
132
|
-
include CascadingConfiguration::
|
130
|
+
class CascadingConfiguration::CompositingHash::Mock03
|
131
|
+
include CascadingConfiguration::Variable
|
132
|
+
include CascadingConfiguration::CompositingHash::Instance
|
133
133
|
end
|
134
|
-
working_instance = CascadingConfiguration::
|
134
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock03
|
135
135
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
136
136
|
cascading_composite_hash.store( :some_setting, :some_value )
|
137
137
|
cascading_composite_hash.local_cascading_hash.should == { :some_setting => :some_value }
|
@@ -142,7 +142,7 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
142
142
|
cascading_composite_hash.local_cascading_hash.should == { :other_setting => :some_value }
|
143
143
|
cascading_composite_hash.should == { :other_setting => :some_value }
|
144
144
|
# instance
|
145
|
-
working_instance = CascadingConfiguration::
|
145
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock03.new
|
146
146
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
147
147
|
cascading_composite_hash.local_cascading_hash.should == {}
|
148
148
|
cascading_composite_hash.should == { :other_setting => :some_value }
|
@@ -151,9 +151,9 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
151
151
|
cascading_composite_hash.local_cascading_hash.exclude_array.should == [ :other_setting ]
|
152
152
|
cascading_composite_hash.should == {}
|
153
153
|
# inheriting class
|
154
|
-
class CascadingConfiguration::
|
154
|
+
class CascadingConfiguration::CompositingHash::Mock03sub1 < CascadingConfiguration::CompositingHash::Mock03
|
155
155
|
end
|
156
|
-
working_instance = CascadingConfiguration::
|
156
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock03sub1
|
157
157
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
158
158
|
cascading_composite_hash.local_cascading_hash.should == {}
|
159
159
|
cascading_composite_hash.should == { :other_setting => :some_value }
|
@@ -162,7 +162,7 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
162
162
|
cascading_composite_hash.local_cascading_hash.exclude_array.should == [ :other_setting ]
|
163
163
|
cascading_composite_hash.should == {}
|
164
164
|
# instance
|
165
|
-
working_instance = CascadingConfiguration::
|
165
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock03sub1.new
|
166
166
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
167
167
|
cascading_composite_hash.local_cascading_hash.should == {}
|
168
168
|
cascading_composite_hash.should == {}
|
@@ -179,11 +179,11 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
179
179
|
|
180
180
|
it 'can merge from another hash' do
|
181
181
|
# primary class
|
182
|
-
class CascadingConfiguration::
|
183
|
-
include CascadingConfiguration::
|
184
|
-
include CascadingConfiguration::
|
182
|
+
class CascadingConfiguration::CompositingHash::Mock04
|
183
|
+
include CascadingConfiguration::Variable
|
184
|
+
include CascadingConfiguration::CompositingHash::Instance
|
185
185
|
end
|
186
|
-
working_instance = CascadingConfiguration::
|
186
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock04
|
187
187
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
188
188
|
cascading_composite_hash.merge!( :some_setting => :some_value )
|
189
189
|
cascading_composite_hash.local_cascading_hash.should == { :some_setting => :some_value }
|
@@ -194,7 +194,7 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
194
194
|
cascading_composite_hash.should == { :some_setting => :some_value,
|
195
195
|
:other_setting => :some_value }
|
196
196
|
# instance
|
197
|
-
working_instance = CascadingConfiguration::
|
197
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock04.new
|
198
198
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
199
199
|
cascading_composite_hash.local_cascading_hash.should == {}
|
200
200
|
cascading_composite_hash.should == { :some_setting => :some_value,
|
@@ -205,9 +205,9 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
205
205
|
:other_setting => :some_value,
|
206
206
|
:another_setting => :some_value }
|
207
207
|
# inheriting class
|
208
|
-
class CascadingConfiguration::
|
208
|
+
class CascadingConfiguration::CompositingHash::Mock04sub1 < CascadingConfiguration::CompositingHash::Mock04
|
209
209
|
end
|
210
|
-
working_instance = CascadingConfiguration::
|
210
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock04sub1
|
211
211
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
212
212
|
cascading_composite_hash.local_cascading_hash.should == {}
|
213
213
|
cascading_composite_hash.should == { :some_setting => :some_value,
|
@@ -218,7 +218,7 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
218
218
|
:other_setting => :some_value,
|
219
219
|
:yet_another_setting => :some_value }
|
220
220
|
# instance
|
221
|
-
working_instance = CascadingConfiguration::
|
221
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock04sub1.new
|
222
222
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
223
223
|
cascading_composite_hash.local_cascading_hash.should == {}
|
224
224
|
cascading_composite_hash.should == { :some_setting => :some_value,
|
@@ -238,11 +238,11 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
238
238
|
|
239
239
|
it 'can replace existing elements with others' do
|
240
240
|
# primary class
|
241
|
-
class CascadingConfiguration::
|
242
|
-
include CascadingConfiguration::
|
243
|
-
include CascadingConfiguration::
|
241
|
+
class CascadingConfiguration::CompositingHash::Mock05
|
242
|
+
include CascadingConfiguration::Variable
|
243
|
+
include CascadingConfiguration::CompositingHash::Instance
|
244
244
|
end
|
245
|
-
working_instance = CascadingConfiguration::
|
245
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock05
|
246
246
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
247
247
|
cascading_composite_hash.replace( :some_setting => :some_value )
|
248
248
|
cascading_composite_hash.local_cascading_hash.should == { :some_setting => :some_value }
|
@@ -251,7 +251,7 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
251
251
|
cascading_composite_hash.local_cascading_hash.should == { :other_setting => :some_value }
|
252
252
|
cascading_composite_hash.should == { :other_setting => :some_value }
|
253
253
|
# instance
|
254
|
-
working_instance = CascadingConfiguration::
|
254
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock05.new
|
255
255
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
256
256
|
cascading_composite_hash.local_cascading_hash.should == {}
|
257
257
|
cascading_composite_hash.should == { :other_setting => :some_value }
|
@@ -259,9 +259,9 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
259
259
|
cascading_composite_hash.local_cascading_hash.should == { :another_setting => :some_value }
|
260
260
|
cascading_composite_hash.should == { :another_setting => :some_value }
|
261
261
|
# inheriting class
|
262
|
-
class CascadingConfiguration::
|
262
|
+
class CascadingConfiguration::CompositingHash::Mock05sub1 < CascadingConfiguration::CompositingHash::Mock05
|
263
263
|
end
|
264
|
-
working_instance = CascadingConfiguration::
|
264
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock05sub1
|
265
265
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
266
266
|
cascading_composite_hash.local_cascading_hash.should == {}
|
267
267
|
cascading_composite_hash.should == { :other_setting => :some_value }
|
@@ -269,7 +269,7 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
269
269
|
cascading_composite_hash.local_cascading_hash.should == { :yet_another_setting => :some_value }
|
270
270
|
cascading_composite_hash.should == { :yet_another_setting => :some_value }
|
271
271
|
# instance
|
272
|
-
working_instance = CascadingConfiguration::
|
272
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock05sub1.new
|
273
273
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
274
274
|
cascading_composite_hash.local_cascading_hash.should == {}
|
275
275
|
cascading_composite_hash.should == { :yet_another_setting => :some_value }
|
@@ -284,11 +284,11 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
284
284
|
|
285
285
|
it 'can shift the first element' do
|
286
286
|
# primary class
|
287
|
-
class CascadingConfiguration::
|
288
|
-
include CascadingConfiguration::
|
289
|
-
include CascadingConfiguration::
|
287
|
+
class CascadingConfiguration::CompositingHash::Mock06
|
288
|
+
include CascadingConfiguration::Variable
|
289
|
+
include CascadingConfiguration::CompositingHash::Instance
|
290
290
|
end
|
291
|
-
working_instance = CascadingConfiguration::
|
291
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock06
|
292
292
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
293
293
|
cascading_composite_hash.replace( :some_setting => :some_value )
|
294
294
|
cascading_composite_hash.local_cascading_hash.should == { :some_setting => :some_value }
|
@@ -301,7 +301,7 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
301
301
|
cascading_composite_hash.shift.should == [ :other_setting, :some_value ]
|
302
302
|
cascading_composite_hash.should == {}
|
303
303
|
# instance
|
304
|
-
working_instance = CascadingConfiguration::
|
304
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock06.new
|
305
305
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
306
306
|
cascading_composite_hash.local_cascading_hash.should == {}
|
307
307
|
cascading_composite_hash.replace( :other_setting => :some_value )
|
@@ -314,9 +314,9 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
314
314
|
cascading_composite_hash.shift.should == [ :another_setting, :some_value ]
|
315
315
|
cascading_composite_hash.should == {}
|
316
316
|
# inheriting class
|
317
|
-
class CascadingConfiguration::
|
317
|
+
class CascadingConfiguration::CompositingHash::Mock06sub1 < CascadingConfiguration::CompositingHash::Mock06
|
318
318
|
end
|
319
|
-
working_instance = CascadingConfiguration::
|
319
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock06sub1
|
320
320
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
321
321
|
cascading_composite_hash.local_cascading_hash.should == {}
|
322
322
|
cascading_composite_hash.replace( :other_setting => :some_value )
|
@@ -329,7 +329,7 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
329
329
|
cascading_composite_hash.shift.should == [ :yet_another_setting, :some_value ]
|
330
330
|
cascading_composite_hash.should == {}
|
331
331
|
# instance
|
332
|
-
working_instance = CascadingConfiguration::
|
332
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock06sub1.new
|
333
333
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
334
334
|
cascading_composite_hash.local_cascading_hash.should == {}
|
335
335
|
cascading_composite_hash.replace( :yet_another_setting => :some_value )
|
@@ -349,11 +349,11 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
349
349
|
|
350
350
|
it 'can clear, causing present elements to be excluded' do
|
351
351
|
# primary class
|
352
|
-
class CascadingConfiguration::
|
353
|
-
include CascadingConfiguration::
|
354
|
-
include CascadingConfiguration::
|
352
|
+
class CascadingConfiguration::CompositingHash::Mock07
|
353
|
+
include CascadingConfiguration::Variable
|
354
|
+
include CascadingConfiguration::CompositingHash::Instance
|
355
355
|
end
|
356
|
-
working_instance = CascadingConfiguration::
|
356
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock07
|
357
357
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
358
358
|
cascading_composite_hash.replace( :some_setting => :some_value )
|
359
359
|
cascading_composite_hash.local_cascading_hash.should == { :some_setting => :some_value }
|
@@ -366,7 +366,7 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
366
366
|
cascading_composite_hash.clear
|
367
367
|
cascading_composite_hash.should == {}
|
368
368
|
# instance
|
369
|
-
working_instance = CascadingConfiguration::
|
369
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock07.new
|
370
370
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
371
371
|
cascading_composite_hash.local_cascading_hash.should == {}
|
372
372
|
cascading_composite_hash.should == {}
|
@@ -376,9 +376,9 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
376
376
|
cascading_composite_hash.clear
|
377
377
|
cascading_composite_hash.should == {}
|
378
378
|
# inheriting class
|
379
|
-
class CascadingConfiguration::
|
379
|
+
class CascadingConfiguration::CompositingHash::Mock07sub1 < CascadingConfiguration::CompositingHash::Mock07
|
380
380
|
end
|
381
|
-
working_instance = CascadingConfiguration::
|
381
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock07sub1
|
382
382
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
383
383
|
cascading_composite_hash.local_cascading_hash.should == {}
|
384
384
|
cascading_composite_hash.should == {}
|
@@ -388,7 +388,7 @@ describe CascadingConfiguration::CascadingCompositeHash do
|
|
388
388
|
cascading_composite_hash.clear
|
389
389
|
cascading_composite_hash.should == {}
|
390
390
|
# instance
|
391
|
-
working_instance = CascadingConfiguration::
|
391
|
+
working_instance = CascadingConfiguration::CompositingHash::Mock07sub1.new
|
392
392
|
cascading_composite_hash = working_instance.composite_hash_for_cascading_configuration( :some_configuration )
|
393
393
|
cascading_composite_hash.local_cascading_hash.should == {}
|
394
394
|
cascading_composite_hash.should == {}
|