cascading-configuration-array 1.2.2 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +0 -40
- data/lib/cascading-configuration-array.rb +2 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/Array.rb +11 -47
- data/lib/cascading-configuration-array/CascadingConfiguration/Array/ModuleInclusionExtensionSupport.rb +3 -3
- data/lib/cascading-configuration-array/CascadingConfiguration/CompositingArray/Instance.rb +3 -10
- metadata +3 -3
data/README.md
CHANGED
@@ -180,46 +180,6 @@ end
|
|
180
180
|
|
181
181
|
Cascading-configuration also provides several other convenience functions.
|
182
182
|
|
183
|
-
### Variable Name Prefixing ###
|
184
|
-
|
185
|
-
Configuration prefix can be set so that variables use property name with the configuration prefix prepended.
|
186
|
-
|
187
|
-
This can be done in order defined (current configuration prefix is stored for configuration), or it can be specified on a per-property basis.
|
188
|
-
|
189
|
-
```ruby
|
190
|
-
module SomeModule
|
191
|
-
|
192
|
-
include CascadingConfiguration
|
193
|
-
|
194
|
-
attr_configuration :some_setting
|
195
|
-
|
196
|
-
self.some_setting = :a_value
|
197
|
-
|
198
|
-
instance_variables.include?( :@some_setting ) # => true
|
199
|
-
|
200
|
-
# we can declare a prefix for specific properties
|
201
|
-
attr_configuration_prefix '__configuration_prefix__', :some_other_setting
|
202
|
-
|
203
|
-
attr_configuration :some_other_setting, :yet_another_setting
|
204
|
-
|
205
|
-
self.some_setting = :some_value
|
206
|
-
self.yet_another_setting = :another_value
|
207
|
-
|
208
|
-
instance_variables.include?( :@some_other_setting ) # => false
|
209
|
-
instance_variables.include?( :@__configuration_prefix__some_other_setting ) # => true
|
210
|
-
instance_variables.include?( :@yet_another_setting ) # => true
|
211
|
-
|
212
|
-
# or we can declare a prefix for all properties defined after prefix is declared
|
213
|
-
attr_configuration_prefix '__another_configuration_prefix__'
|
214
|
-
|
215
|
-
attr_configuration :still_another_prefix
|
216
|
-
|
217
|
-
instance_variables.include?( :@still_another_prefix ) # => false
|
218
|
-
instance_variables.include?( :@__another_configuration_prefix__still_another_prefix ) # => true
|
219
|
-
|
220
|
-
end
|
221
|
-
```
|
222
|
-
|
223
183
|
### Method Redefinition ###
|
224
184
|
|
225
185
|
Any declared configuration is defined in order to support locally redefining the method and accessing the original by calling super.
|
@@ -1,56 +1,20 @@
|
|
1
1
|
|
2
2
|
module CascadingConfiguration::Array
|
3
3
|
|
4
|
+
extend ModuleCluster
|
5
|
+
|
4
6
|
extend CascadingConfiguration::InternalModuleStub
|
5
7
|
|
6
8
|
include CascadingConfiguration::Variable
|
7
9
|
include CascadingConfiguration::CompositingArray::Instance
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
########################
|
20
|
-
# self.extend_object #
|
21
|
-
########################
|
22
|
-
|
23
|
-
def self.extend_object( class_or_module )
|
24
|
-
CascadingConfiguration::Variable.define_accessor_module_support( class_or_module )
|
25
|
-
super
|
26
|
-
end
|
27
|
-
|
28
|
-
###################
|
29
|
-
# self.included #
|
30
|
-
###################
|
31
|
-
|
32
|
-
def self.included( class_or_module )
|
33
|
-
module_self = self
|
34
|
-
class_or_module.instance_eval do
|
35
|
-
extend module_self
|
36
|
-
extend module_self::Interface
|
37
|
-
extend module_self::AccessorDefinitionMethods
|
38
|
-
extend CascadingConfiguration::Variable::Interface
|
39
|
-
extend CascadingConfiguration::Array::ModuleInclusionExtensionSupport unless is_a?( Class )
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
###################
|
44
|
-
# self.extended #
|
45
|
-
###################
|
46
|
-
|
47
|
-
def self.extended( class_or_module )
|
48
|
-
module_self = self
|
49
|
-
class_or_module.instance_eval do
|
50
|
-
extend module_self::Interface
|
51
|
-
extend module_self::AccessorDefinitionMethods
|
52
|
-
extend CascadingConfiguration::Variable::Interface
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
11
|
+
include_cascades_extends( CascadingConfiguration::Array,
|
12
|
+
CascadingConfiguration::Array::Interface,
|
13
|
+
CascadingConfiguration::Array::AccessorDefinitionMethods )
|
14
|
+
|
15
|
+
include_cascades_extends_to_module( CascadingConfiguration::Array::ModuleInclusionExtensionSupport )
|
16
|
+
|
17
|
+
extend_cascades_extends( CascadingConfiguration::Array::Interface,
|
18
|
+
CascadingConfiguration::Array::AccessorDefinitionMethods )
|
19
|
+
|
56
20
|
end
|
@@ -9,15 +9,13 @@ module CascadingConfiguration::Array::ModuleInclusionExtensionSupport
|
|
9
9
|
|
10
10
|
def included( class_or_module )
|
11
11
|
super if defined?( super )
|
12
|
-
# CascadingConfiguration::Array
|
12
|
+
# the module that is including/extending CascadingConfiguration::Array
|
13
13
|
module_self = self
|
14
14
|
class_or_module.instance_eval do
|
15
15
|
# include accessors defined for instances
|
16
16
|
include module_self.accessor_instance_support
|
17
17
|
# extend accessors defined for modules (and classes, which are modules)
|
18
18
|
extend module_self.accessor_module_support
|
19
|
-
extend CascadingConfiguration::Array
|
20
|
-
extend CascadingConfiguration::Array::ModuleInclusionExtensionSupport unless is_a?( Class )
|
21
19
|
end
|
22
20
|
end
|
23
21
|
|
@@ -30,7 +28,9 @@ module CascadingConfiguration::Array::ModuleInclusionExtensionSupport
|
|
30
28
|
# CascadingConfiguration::Array
|
31
29
|
module_self = self
|
32
30
|
class_or_module.instance_eval do
|
31
|
+
# extend accessors defined for modules (and classes, which are modules)
|
33
32
|
extend module_self.accessor_module_support
|
33
|
+
# tell ancestor_configuration_chain to search the eigenclass chain as well
|
34
34
|
extend CascadingConfiguration::Variable::EigenclassConfigurationChain
|
35
35
|
end
|
36
36
|
end
|
@@ -1,19 +1,12 @@
|
|
1
1
|
|
2
2
|
module CascadingConfiguration::CompositingArray::Instance
|
3
3
|
|
4
|
+
extend ModuleCluster
|
5
|
+
|
4
6
|
extend CascadingConfiguration::InternalModuleStub
|
5
7
|
|
6
|
-
|
7
|
-
# self.included #
|
8
|
-
###################
|
8
|
+
include_also_extends( self )
|
9
9
|
|
10
|
-
def self.included( class_or_module )
|
11
|
-
module_self = self
|
12
|
-
class_or_module.instance_eval do
|
13
|
-
extend module_self
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
10
|
#################################################
|
18
11
|
# composite_array_for_cascading_configuration #
|
19
12
|
#################################################
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 1.2.
|
8
|
+
- 4
|
9
|
+
version: 1.2.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Asher
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-08-01 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|