cascading-configuration-setting 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -177,46 +177,6 @@ end
|
|
177
177
|
|
178
178
|
Cascading-configuration also provides several other convenience functions.
|
179
179
|
|
180
|
-
### Variable Name Prefixing ###
|
181
|
-
|
182
|
-
Configuration prefix can be set so that variables use property name with the configuration prefix prepended.
|
183
|
-
|
184
|
-
This can be done in order defined (current configuration prefix is stored for configuration), or it can be specified on a per-property basis.
|
185
|
-
|
186
|
-
```ruby
|
187
|
-
module SomeModule
|
188
|
-
|
189
|
-
include CascadingConfiguration
|
190
|
-
|
191
|
-
attr_configuration :some_setting
|
192
|
-
|
193
|
-
self.some_setting = :a_value
|
194
|
-
|
195
|
-
instance_variables.include?( :@some_setting ) # => true
|
196
|
-
|
197
|
-
# we can declare a prefix for specific properties
|
198
|
-
attr_configuration_prefix '__configuration_prefix__', :some_other_setting
|
199
|
-
|
200
|
-
attr_configuration :some_other_setting, :yet_another_setting
|
201
|
-
|
202
|
-
self.some_setting = :some_value
|
203
|
-
self.yet_another_setting = :another_value
|
204
|
-
|
205
|
-
instance_variables.include?( :@some_other_setting ) # => false
|
206
|
-
instance_variables.include?( :@__configuration_prefix__some_other_setting ) # => true
|
207
|
-
instance_variables.include?( :@yet_another_setting ) # => true
|
208
|
-
|
209
|
-
# or we can declare a prefix for all properties defined after prefix is declared
|
210
|
-
attr_configuration_prefix '__another_configuration_prefix__'
|
211
|
-
|
212
|
-
attr_configuration :still_another_prefix
|
213
|
-
|
214
|
-
instance_variables.include?( :@still_another_prefix ) # => false
|
215
|
-
instance_variables.include?( :@__another_configuration_prefix__still_another_prefix ) # => true
|
216
|
-
|
217
|
-
end
|
218
|
-
```
|
219
|
-
|
220
180
|
### Method Redefinition ###
|
221
181
|
|
222
182
|
Any declared configuration is defined in order to support locally redefining the method and accessing the original by calling super.
|
@@ -18,7 +18,7 @@ describe CascadingConfiguration::Setting::AccessorDefinitionMethods do
|
|
18
18
|
CascadingConfiguration::Setting::Mock.methods.include?( setter_method_name ).should == true
|
19
19
|
CascadingConfiguration::Setting::Mock.instance_methods.include?( setter_method_name ).should == true
|
20
20
|
CascadingConfiguration::Setting::Mock.some_configuration = :a_setting_not_yet_used
|
21
|
-
CascadingConfiguration::Setting::Mock.
|
21
|
+
CascadingConfiguration::Setting::Mock.accessor_module_support.get_configuration_variable( CascadingConfiguration::Setting::Mock, :some_configuration ).should == :a_setting_not_yet_used
|
22
22
|
# getter
|
23
23
|
CascadingConfiguration::Setting::Mock.define_cascading_getter( :some_configuration )
|
24
24
|
CascadingConfiguration::Setting::Mock.methods.include?( :some_configuration ).should == true
|
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
|
+
- 3
|
9
|
+
version: 1.2.3
|
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-21 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|