Class: Gumdrop::HashObject

Inherits:
ActiveSupport::HashWithIndifferentAccess
  • Object
show all
Defined in:
lib/gumdrop/hash_object.rb

Direct Known Subclasses

Config

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/gumdrop/hash_object.rb', line 5

def method_missing(sym, *args, &block)
  if self.has_key? sym
    self[sym]

  elsif sym.to_s.ends_with? '='
    key= sym.to_s.chop.to_sym
    self[key]= args[0]

  else
    # FIXME: Return super() or nil for Model#method_missing?
    # super sym, *args, &block
    nil
  end
end