Class: AppConfig::Storage::Base
- Inherits:
-
Object
- Object
- AppConfig::Storage::Base
- Defined in:
- lib/app_config/storage/base.rb
Instance Method Summary collapse
-
#initialize(options = nil) ⇒ Base
constructor
A new instance of Base.
-
#method_missing(name, *args) ⇒ Object
Wrap ‘method_missing` to proxy to `@data`.
- #to_hash ⇒ Object
Constructor Details
#initialize(options = nil) ⇒ Base
Returns a new instance of Base.
5 6 7 |
# File 'lib/app_config/storage/base.rb', line 5 def initialize( = nil) @data = Storage::ConfigData.new() end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
Wrap ‘method_missing` to proxy to `@data`.
14 15 16 17 18 19 20 21 22 |
# File 'lib/app_config/storage/base.rb', line 14 def method_missing(name, *args) unless @data.nil? if name =~ /.+=$/ # Caller is a setter. @data.send(name.to_sym, *args[0]) else @data.send(name.to_sym) end end end |
Instance Method Details
#to_hash ⇒ Object
9 10 11 |
# File 'lib/app_config/storage/base.rb', line 9 def to_hash defined?(@data) ? @data.to_hash : Hash.new end |