Class: Carload::ExtendedHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/carload/extended_hash.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/carload/extended_hash.rb', line 3

def method_missing method, *args, &block
  key = method.to_s.gsub('=', '').to_sym
  if method.to_s =~ /=$/
    self[key] = args.first
  else
    self[key]
  end
end