Class: Vapir::HashConfigurationWithOtherStuff
- Inherits:
-
Configuration
- Object
- Configuration
- Vapir::HashConfigurationWithOtherStuff
- Defined in:
- lib/vapir-common/config.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#key_prefix ⇒ Object
Returns the value of attribute key_prefix.
Attributes inherited from Configuration
Instance Method Summary collapse
Methods inherited from Configuration
#[], #[]=, #create, #create_update, #define_key_methods, #defined_hash, #defined_key?, #defined_keys, #delete, #initialize, #locally_defined_key?, #method_missing, #read, #recognize_key!, #recognized_key?, #recognized_keys, #update, #update_hash, #validate_key_format!, #with_config
Constructor Details
This class inherits a constructor from Vapir::Configuration
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Vapir::Configuration
Instance Attribute Details
#key_prefix ⇒ Object
Returns the value of attribute key_prefix.
273 274 275 |
# File 'lib/vapir-common/config.rb', line 273 def key_prefix @key_prefix end |
Instance Method Details
#unprefixed_recognized_key(prefixed_key) ⇒ Object
274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/vapir-common/config.rb', line 274 def unprefixed_recognized_key(prefixed_key) key_prefix=self.key_prefix || '' if prefixed_key.is_a?(String) || prefixed_key.is_a?(Symbol) prefixed_key=prefixed_key.to_s if prefixed_key[0...key_prefix.length].downcase==key_prefix.downcase key=prefixed_key[key_prefix.length..-1] if recognized_key?(key) return key end end end return nil end |
#update_from_source ⇒ Object
287 288 289 290 291 292 293 |
# File 'lib/vapir-common/config.rb', line 287 def update_from_source config_hash.each do |hash_key, value| if key=unprefixed_recognized_key(hash_key) update(key, value) end end end |