Class: Hash

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

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *params) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/hash_extension.rb', line 2

def method_missing(method, *params)
  method_string = method.to_s
  if method_string.last == "="
    self[method_string[0..-2]] = params.first
  else
    self[method_string]
  end
end