Class: HasConfiguration::Configuration
- Defined in:
- lib/has_configuration/configuration.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(klass, options = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #to_h(type = nil) ⇒ Object
Constructor Details
#initialize(klass, options = {}) ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 |
# File 'lib/has_configuration/configuration.rb', line 9 def initialize(klass, = {}) @class_name = klass.name @options = load_file init_hash end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object (private)
27 28 29 |
# File 'lib/has_configuration/configuration.rb', line 27 def method_missing(sym, *args, &block) configuration.send(sym, *args, &block) || super end |
Instance Method Details
#to_h(type = nil) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/has_configuration/configuration.rb', line 17 def to_h(type = nil) case type when :symbolized then deep_symbolized_hash when :stringify then deep_stringified_hash else @hash end end |