cascading-configuration-setting 1.1.0 → 1.1.1
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/lib/cascading-configuration-setting/CascadingConfiguration/Setting.rb +5 -12
- data/lib/cascading-configuration-setting/CascadingConfiguration/Setting/Accessors.rb +3 -18
- data/lib/cascading-configuration-setting/CascadingConfiguration/Setting/ModuleInstance.rb +6 -7
- data/spec/CascadingConfiguration/{ConfigurationSetting → Setting}/Accessors_spec.rb +0 -0
- data/spec/CascadingConfiguration/{ConfigurationSetting_spec.rb → Setting_spec.rb} +0 -0
- metadata +5 -5
@@ -12,9 +12,9 @@ module CascadingConfiguration::Setting
|
|
12
12
|
class_or_module.instance_eval do
|
13
13
|
include CascadingConfiguration::Variable
|
14
14
|
extend module_self
|
15
|
-
include
|
16
|
-
extend
|
17
|
-
extend
|
15
|
+
include module_self::ObjectInstance
|
16
|
+
extend module_self::ClassInstance
|
17
|
+
extend module_self::Accessors
|
18
18
|
# module support
|
19
19
|
unless is_a?( Class )
|
20
20
|
extend CascadingConfiguration::Setting::ModuleInstance
|
@@ -22,14 +22,6 @@ module CascadingConfiguration::Setting
|
|
22
22
|
end
|
23
23
|
end
|
24
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::Setting::ModuleInstance )
|
31
|
-
end
|
32
|
-
|
33
25
|
########################################
|
34
26
|
# get_configuration_searching_upward #
|
35
27
|
########################################
|
@@ -38,7 +30,8 @@ module CascadingConfiguration::Setting
|
|
38
30
|
|
39
31
|
configuration = nil
|
40
32
|
|
41
|
-
|
33
|
+
klass = ( is_a?( Module ) ? self : self.class )
|
34
|
+
configuration_variable = klass::AccessorSupportModule.cascading_variable_name( configuration_name )
|
42
35
|
|
43
36
|
ancestors_to_Object.each do |this_ancestor|
|
44
37
|
if this_ancestor.instance_variable_defined?( configuration_variable )
|
@@ -3,32 +3,17 @@ module CascadingConfiguration::Setting::Accessors
|
|
3
3
|
|
4
4
|
extend CascadingConfiguration::InternalModuleStub
|
5
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
6
|
#############################
|
23
7
|
# define_cascading_setter #
|
24
8
|
#############################
|
25
9
|
|
26
10
|
def define_cascading_setter( configuration_name )
|
27
11
|
configuration_setter_name = ( configuration_name.to_s + '=' ).to_s
|
28
|
-
|
12
|
+
accessor_support_module = self::AccessorSupportModule
|
13
|
+
accessor_support_module.module_eval do
|
29
14
|
define_method( configuration_setter_name ) do |value|
|
30
15
|
# configuration setter returns setting variable (variable from self), which is now the ID of value
|
31
|
-
return instance_variable_set( cascading_variable_name( configuration_name ), value )
|
16
|
+
return instance_variable_set( accessor_support_module.cascading_variable_name( configuration_name ), value )
|
32
17
|
end
|
33
18
|
end
|
34
19
|
end
|
@@ -2,22 +2,21 @@
|
|
2
2
|
module CascadingConfiguration::Setting::ModuleInstance
|
3
3
|
|
4
4
|
extend CascadingConfiguration::InternalModuleStub
|
5
|
-
|
5
|
+
|
6
6
|
##############
|
7
7
|
# included #
|
8
8
|
##############
|
9
9
|
|
10
10
|
def included( class_or_module )
|
11
11
|
super if method_defined?( :super )
|
12
|
+
# CascadingConfiguration::Setting
|
12
13
|
module_self = self
|
13
14
|
class_or_module.instance_eval do
|
14
|
-
|
15
|
-
# when we extend a module (which has happened if we got here)
|
16
|
-
# then we need to make sure when the module we are extending is included
|
17
|
-
# * CascadingConfiguration is included
|
18
|
-
# * the module we extended is used to extend the class/module that included
|
15
|
+
# whichever module included CascadingConfiguration::Setting
|
19
16
|
extend module_self
|
17
|
+
# cascade CascadingConfiguration::Setting
|
18
|
+
include CascadingConfiguration::Setting
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
23
|
-
end
|
22
|
+
end
|
File without changes
|
File without changes
|
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
|
+
- 1
|
9
|
+
version: 1.1.1
|
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-07-
|
17
|
+
date: 2011-07-15 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -44,8 +44,8 @@ files:
|
|
44
44
|
- lib/cascading-configuration-setting/CascadingConfiguration/Setting/ModuleInstance.rb
|
45
45
|
- lib/cascading-configuration-setting/CascadingConfiguration/Setting.rb
|
46
46
|
- lib/cascading-configuration-setting.rb
|
47
|
-
- spec/CascadingConfiguration/
|
48
|
-
- spec/CascadingConfiguration/
|
47
|
+
- spec/CascadingConfiguration/Setting/Accessors_spec.rb
|
48
|
+
- spec/CascadingConfiguration/Setting_spec.rb
|
49
49
|
- README.md
|
50
50
|
- README.rdoc
|
51
51
|
has_rdoc: true
|