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, #defined_key?, #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.
244 245 246 |
# File 'lib/vapir-common/config.rb', line 244 def key_prefix @key_prefix end |
Instance Method Details
#unprefixed_recognized_key(prefixed_key) ⇒ Object
245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/vapir-common/config.rb', line 245 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
258 259 260 261 262 263 264 |
# File 'lib/vapir-common/config.rb', line 258 def update_from_source config_hash.each do |hash_key, value| if key=unprefixed_recognized_key(hash_key) update(key, value) end end end |