class IceCube::FlexibleHash
Find keys by symbol or string without symbolizing user input Due to the serialization format of ice_cube, this limited implementation is entirely sufficient
Public Instance Methods
Source
# File lib/ice_cube/flexible_hash.rb, line 9 def [](key) key = _match_key(key) super end
Calls superclass method
Source
# File lib/ice_cube/flexible_hash.rb, line 19 def delete(key) key = _match_key(key) super end
Calls superclass method
Source
# File lib/ice_cube/flexible_hash.rb, line 14 def fetch(key) key = _match_key(key) super end
Calls superclass method
Private Instance Methods
Source
# File lib/ice_cube/flexible_hash.rb, line 26 def _match_key(key) return key if __getobj__.has_key? key if key.instance_of?(Symbol) __getobj__.keys.detect { |k| return k if k == key.to_s } elsif key.instance_of?(String) __getobj__.keys.detect { |k| return k if k.to_s == key } end key end