cascading-configuration-setting 1.6.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cascading-configuration-setting.rb +5 -2
- data/lib/cascading-configuration-setting/CascadingConfiguration/Setting/Interface.rb +7 -7
- data/lib/cascading-configuration-setting/_private_/CascadingConfiguration/Setting/Interface/GettersSetters.rb +18 -18
- data/spec/CascadingConfiguration/Setting_spec.rb +5 -1
- metadata +6 -6
@@ -1,6 +1,9 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
2
|
+
if $__cascading_configuration__spec__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
9
|
module Setting
|
@@ -8,8 +8,8 @@ module CascadingConfiguration::Setting::Interface
|
|
8
8
|
# attr_configuration #
|
9
9
|
########################
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
# defines configuration in class or module
|
12
|
+
# configuration cascades downward to instance including all classes or modules in-between
|
13
13
|
def attr_configuration( *configuration_names )
|
14
14
|
|
15
15
|
configuration_names.each do |this_configuration_name|
|
@@ -27,8 +27,8 @@ module CascadingConfiguration::Setting::Interface
|
|
27
27
|
# attr_module_configuration #
|
28
28
|
###############################
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
# defines configuration in class or module
|
31
|
+
# configuration cascades downward to last class or module
|
32
32
|
def attr_module_configuration( *configuration_names )
|
33
33
|
|
34
34
|
configuration_names.each do |this_configuration_name|
|
@@ -41,7 +41,7 @@ module CascadingConfiguration::Setting::Interface
|
|
41
41
|
return self
|
42
42
|
|
43
43
|
end
|
44
|
-
|
44
|
+
alias_method :attr_class_configuration, :attr_module_configuration
|
45
45
|
|
46
46
|
##############################
|
47
47
|
# attr_local_configuration #
|
@@ -53,7 +53,7 @@ module CascadingConfiguration::Setting::Interface
|
|
53
53
|
# * first class to include module (inherited)
|
54
54
|
def attr_local_configuration( *configuration_names )
|
55
55
|
|
56
|
-
|
56
|
+
CascadingConfiguration::Variable.create_local_instance_configuration_support_module( self )
|
57
57
|
|
58
58
|
configuration_names.each do |this_configuration_name|
|
59
59
|
# define configuration setter
|
@@ -74,7 +74,7 @@ module CascadingConfiguration::Setting::Interface
|
|
74
74
|
# * only in the instance that declares it
|
75
75
|
def attr_object_configuration( *configuration_names )
|
76
76
|
|
77
|
-
|
77
|
+
CascadingConfiguration::Variable.create_local_instance_configuration_support_module( self )
|
78
78
|
|
79
79
|
configuration_names.each do |this_configuration_name|
|
80
80
|
# define configuration setter
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
module CascadingConfiguration::Setting::Interface::GettersSetters
|
3
|
-
|
3
|
+
|
4
4
|
#############################
|
5
5
|
# define_cascading_setter #
|
6
6
|
#############################
|
@@ -13,8 +13,8 @@ module CascadingConfiguration::Setting::Interface::GettersSetters
|
|
13
13
|
::CascadingConfiguration::Variable.set_configuration_variable( self, configuration_name, value )
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
::CascadingConfiguration::Variable.define_module_method( self, configuration_setter_name, & setter_proc )
|
17
|
+
::CascadingConfiguration::Variable.define_instance_method_if_support_exists( self, configuration_setter_name, & setter_proc )
|
18
18
|
|
19
19
|
end
|
20
20
|
|
@@ -30,8 +30,8 @@ module CascadingConfiguration::Setting::Interface::GettersSetters
|
|
30
30
|
return ::CascadingConfiguration::Variable.get_configuration_searching_upward( self, configuration_name )
|
31
31
|
end
|
32
32
|
|
33
|
-
|
34
|
-
|
33
|
+
::CascadingConfiguration::Variable.define_module_method( self, configuration_getter_name, & getter_proc )
|
34
|
+
::CascadingConfiguration::Variable.define_instance_method_if_support_exists( self, configuration_getter_name, & getter_proc )
|
35
35
|
|
36
36
|
end
|
37
37
|
|
@@ -50,7 +50,7 @@ module CascadingConfiguration::Setting::Interface::GettersSetters
|
|
50
50
|
configuration_name,
|
51
51
|
value )
|
52
52
|
|
53
|
-
|
53
|
+
end
|
54
54
|
|
55
55
|
end
|
56
56
|
|
@@ -71,7 +71,7 @@ module CascadingConfiguration::Setting::Interface::GettersSetters
|
|
71
71
|
return ::CascadingConfiguration::Variable.get_configuration_searching_upward( self,
|
72
72
|
configuration_name )
|
73
73
|
|
74
|
-
|
74
|
+
end
|
75
75
|
|
76
76
|
end
|
77
77
|
|
@@ -91,7 +91,7 @@ module CascadingConfiguration::Setting::Interface::GettersSetters
|
|
91
91
|
end
|
92
92
|
|
93
93
|
::CascadingConfiguration::Variable.define_local_instance_method( self, configuration_setter_name, & local_setter_proc )
|
94
|
-
|
94
|
+
::CascadingConfiguration::Variable.define_instance_method_if_support_exists( self, configuration_setter_name, & local_setter_proc )
|
95
95
|
|
96
96
|
end
|
97
97
|
|
@@ -112,11 +112,11 @@ module CascadingConfiguration::Setting::Interface::GettersSetters
|
|
112
112
|
end
|
113
113
|
|
114
114
|
::CascadingConfiguration::Variable.define_local_instance_method( self, configuration_getter_name, & local_getter_proc )
|
115
|
-
|
115
|
+
::CascadingConfiguration::Variable.define_instance_method_if_support_exists( self, configuration_getter_name, & local_getter_proc )
|
116
116
|
|
117
117
|
end
|
118
|
-
|
119
|
-
|
118
|
+
|
119
|
+
##########################################
|
120
120
|
# define_instance_configuration_setter #
|
121
121
|
##########################################
|
122
122
|
|
@@ -125,11 +125,11 @@ module CascadingConfiguration::Setting::Interface::GettersSetters
|
|
125
125
|
configuration_setter_name = ( configuration_name.to_s + '=' ).to_s
|
126
126
|
|
127
127
|
::CascadingConfiguration::Variable.define_instance_method( self, configuration_setter_name ) do |value|
|
128
|
-
|
129
|
-
|
130
|
-
|
128
|
+
|
129
|
+
# configuration setter returns setting variable (variable from self), which is now the ID of value
|
130
|
+
return ::CascadingConfiguration::Variable.set_configuration_variable( self, configuration_name, value )
|
131
131
|
|
132
|
-
|
132
|
+
end
|
133
133
|
|
134
134
|
end
|
135
135
|
|
@@ -147,7 +147,7 @@ module CascadingConfiguration::Setting::Interface::GettersSetters
|
|
147
147
|
# that means first variable that has been set
|
148
148
|
return ::CascadingConfiguration::Variable.get_configuration_variable( self, configuration_name )
|
149
149
|
|
150
|
-
|
150
|
+
end
|
151
151
|
|
152
152
|
end
|
153
153
|
|
@@ -166,7 +166,7 @@ module CascadingConfiguration::Setting::Interface::GettersSetters
|
|
166
166
|
# configuration setter returns setting variable (variable from self), which is now the ID of value
|
167
167
|
return ::CascadingConfiguration::Variable.set_configuration_variable( self, configuration_name, value )
|
168
168
|
|
169
|
-
|
169
|
+
end
|
170
170
|
|
171
171
|
end
|
172
172
|
|
@@ -186,7 +186,7 @@ module CascadingConfiguration::Setting::Interface::GettersSetters
|
|
186
186
|
# that means first variable that has been set
|
187
187
|
return ::CascadingConfiguration::Variable.get_configuration_variable( self, configuration_name )
|
188
188
|
|
189
|
-
|
189
|
+
end
|
190
190
|
|
191
191
|
end
|
192
192
|
|
@@ -1,5 +1,9 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
if $__cascading_configuration__spec__development
|
3
|
+
require_relative '../../lib/cascading-configuration-setting.rb'
|
4
|
+
else
|
5
|
+
require 'cascading-configuration-setting'
|
6
|
+
end
|
3
7
|
|
4
8
|
describe CascadingConfiguration::Setting do
|
5
9
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cascading-configuration-setting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.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-02-
|
12
|
+
date: 2012-02-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: module-cluster
|
16
|
-
requirement: &
|
16
|
+
requirement: &70340659285960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70340659285960
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: cascading-configuration-variable
|
27
|
-
requirement: &
|
27
|
+
requirement: &70340659285020 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70340659285020
|
36
36
|
description: Provides :attr_configuration.
|
37
37
|
email: asher@ridiculouspower.com
|
38
38
|
executables: []
|