Class: OpenObject

Inherits:
Hash show all
Defined in:
lib/buildr/core/util.rb

Instance Method Summary collapse

Constructor Details

#initialize(source = nil, &block) ⇒ OpenObject

Returns a new instance of OpenObject.



65
66
67
68
# File 'lib/buildr/core/util.rb', line 65

def initialize(source=nil, &block)
  super &block
  update source if source
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args) ⇒ Object



70
71
72
73
74
75
76
# File 'lib/buildr/core/util.rb', line 70

def method_missing(symbol, *args)
  if symbol.to_s =~ /=$/
    self[symbol.to_s[0..-2].to_sym] = args.first
  else
    self[symbol]
  end
end