Class: OpenObject

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

Instance Method Summary collapse

Methods inherited from Hash

#except, from_java_properties, #only, #to_java_properties

Constructor Details

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

Returns a new instance of OpenObject.



253
254
255
256
# File 'lib/buildr/core/util.rb', line 253

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



258
259
260
261
262
263
264
# File 'lib/buildr/core/util.rb', line 258

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