Class: SVUtil::Defaults

Inherits:
Object
  • Object
show all
Defined in:
lib/svutil/config.rb

Instance Method Summary collapse

Constructor Details

#initializeDefaults

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