Class: Confix::Config
- Inherits:
-
Object
- Object
- Confix::Config
- Extended by:
- ClassMethods
- Includes:
- InstanceMethods
- Defined in:
- lib/confix.rb
Overview
A simple Config object, which is created if people access a intermediate setting.
Instance Attribute Summary
Attributes included from ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #child? ⇒ Boolean
-
#config_root ⇒ Object
Resolves the root configuration object.
-
#initialize(parent = nil) ⇒ Config
constructor
A new instance of Config.
- #inspect ⇒ Object
Methods included from ClassMethods
config, configs, defaults, expand_key, key_defined?, setting, settings
Methods included from InstanceMethods
#get, included, #set, #to_hash, #update
Constructor Details
#initialize(parent = nil) ⇒ Config
Returns a new instance of Config.
384 385 386 |
# File 'lib/confix.rb', line 384 def initialize(parent = nil) @parent = parent end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Confix::InstanceMethods
Class Method Details
.name ⇒ Object
399 400 401 |
# File 'lib/confix.rb', line 399 def self.name "Confix::Config(#{key_from_root})" end |
Instance Method Details
#child? ⇒ Boolean
392 393 394 |
# File 'lib/confix.rb', line 392 def child? true end |
#config_root ⇒ Object
Resolves the root configuration object.
389 390 391 |
# File 'lib/confix.rb', line 389 def config_root @config_root ||= @parent ? @parent.config_root : self end |
#inspect ⇒ Object
403 404 405 |
# File 'lib/confix.rb', line 403 def inspect super.sub(/#<Class:0x[a-f0-9]+>/, "#<#{self.class.name}>") end |