Class: SVUtil::Defaults
- Inherits:
-
Object
- Object
- SVUtil::Defaults
- Defined in:
- lib/svutil/config.rb
Instance Method Summary collapse
- #default_for(name) ⇒ Object
-
#initialize ⇒ Defaults
constructor
A new instance of Defaults.
Constructor Details
#initialize ⇒ Defaults
Returns a new instance of Defaults.
12 13 14 |
# File 'lib/svutil/config.rb', line 12 def initialize @attrs = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_id, *args) ⇒ Object (private)
21 22 23 24 25 26 |
# File 'lib/svutil/config.rb', line 21 def method_missing(method_id, *args) @attrs ||= {} if method_id.to_s =~ /=$/ @attrs[method_id.to_s[0...-1]] = args.first end end |
Instance Method Details
#default_for(name) ⇒ Object
16 17 18 |
# File 'lib/svutil/config.rb', line 16 def default_for(name) @attrs[name] end |