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.



225
226
227
228
# File 'lib/buildr/core/util.rb', line 225

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



230
231
232
233
234
235
236
# File 'lib/buildr/core/util.rb', line 230

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