Module: IndifferentAccess

Defined in:
lib/mm_dirtier/support.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



30
31
32
33
34
# File 'lib/mm_dirtier/support.rb', line 30

def method_missing(sym,*args,&block)
  return self[sym.to_s[0..-2]] = args[0] if sym.to_s =~ /.*=$/
  return self[sym] if self.keys.include?(sym.to_s)
  nil
end

Instance Method Details

#[](key) ⇒ Object



13
14
15
16
# File 'lib/mm_dirtier/support.rb', line 13

def [](key)
  key = key.to_s
  super(key)
end

#[]=(key, val) ⇒ Object



18
19
20
# File 'lib/mm_dirtier/support.rb', line 18

def []=(key,val)
  super(key.to_s,val)
end

#delete(key) ⇒ Object



26
27
28
# File 'lib/mm_dirtier/support.rb', line 26

def delete(key)
  super(key.to_s)
end

#include?(key) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/mm_dirtier/support.rb', line 22

def include?(key)
  super(key.to_s)
end