Class: HashWithIndifferentAccess

Inherits:
Object
  • Object
show all
Defined in:
lib/cute-hex.rb

Overview

Monkey-patch AS/HWIA

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *opts) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cute-hex.rb', line 8

def method_missing(method, *opts)
  case method
  when /\=$/
    m = method.to_s.gsub(/\=$/, '') # strip assignment operator
    self[m] = opts.first

    return self
  else
    return self[method]
  end
end