Class: Sequelinha::Config
- Inherits:
-
Object
- Object
- Sequelinha::Config
- Defined in:
- lib/sequelinha/config.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(data = {}) ⇒ Config
constructor
A new instance of Config.
- #method_missing(sym, *args) ⇒ Object
Constructor Details
#initialize(data = {}) ⇒ Config
Returns a new instance of Config.
3 4 5 |
# File 'lib/sequelinha/config.rb', line 3 def initialize(data={}) @data = data end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/sequelinha/config.rb', line 19 def method_missing(sym, *args) if sym.to_s =~ /(.+)=$/ self[$1] = args.first else self[sym] end end |
Instance Method Details
#[](key) ⇒ Object
7 8 9 |
# File 'lib/sequelinha/config.rb', line 7 def [](key) @data[key.to_sym] end |