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.
7 8 9 10 11 12 13 |
# File 'lib/has_configuration/configuration.rb', line 7 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)
25 26 27 |
# File 'lib/has_configuration/configuration.rb', line 25 def method_missing(sym, *args, &block) configuration.send(sym, *args, &block) || super end |
Instance Method Details
#to_h(type = nil) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/has_configuration/configuration.rb', line 15 def to_h(type = nil) case type when :symbolized then deep_symbolized_hash when :stringify then deep_stringified_hash else @hash end end |