Class: Groundcrew::Hashwrapper

Inherits:
Struct
  • Object
show all
Defined in:
lib/groundcrew.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/groundcrew.rb', line 62

def method_missing(method_name, *args)
  case child = hash[method_name.to_s]
  when Hash;  Hashwrapper.new child
  when Array; child.map{ |x| Hash === x ? Hashwrapper.new(x) : x }
  else child
  end
end