Module: Wonkavision::MessageMapper::IndifferentAccess

Included in:
Map
Defined in:
lib/wonkavision/message_mapper/indifferent_access.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



21
22
23
24
25
# File 'lib/wonkavision/message_mapper/indifferent_access.rb', line 21

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



4
5
6
7
# File 'lib/wonkavision/message_mapper/indifferent_access.rb', line 4

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

#[]=(key, val) ⇒ Object



9
10
11
# File 'lib/wonkavision/message_mapper/indifferent_access.rb', line 9

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

#delete(key) ⇒ Object



17
18
19
# File 'lib/wonkavision/message_mapper/indifferent_access.rb', line 17

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

#include?(key) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/wonkavision/message_mapper/indifferent_access.rb', line 13

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