class HashWithIndifferentAccess
Public Class Methods
convert_value(value)
click to toggle source
# File lib/fleck/hash_with_indifferent_access.rb, line 24 def self.convert_value(value) if value.is_a?(Hash) value.to_hash_with_indifferent_access elsif value.is_a?(Array) value.map!{|item| item.is_a?(Hash) || item.is_a?(Array) ? HashWithIndifferentAccess.convert_value(item) : item } else value end end
new(original)
click to toggle source
Calls superclass method
# File lib/fleck/hash_with_indifferent_access.rb, line 3 def initialize(original) super(nil) copy_from(original) end
Public Instance Methods
[](key)
click to toggle source
Calls superclass method
# File lib/fleck/hash_with_indifferent_access.rb, line 12 def [](key) super(key.to_s) end
[]=(key, value)
click to toggle source
Calls superclass method
# File lib/fleck/hash_with_indifferent_access.rb, line 8 def []=(key, value) super(key.to_s, self.class.convert_value(value)) end
delete(key)
click to toggle source
Calls superclass method
# File lib/fleck/hash_with_indifferent_access.rb, line 20 def delete(key) super(key.to_s) end
fetch(key, *extras)
click to toggle source
Calls superclass method
# File lib/fleck/hash_with_indifferent_access.rb, line 16 def fetch(key, *extras) super(key.to_s, *extras) end
inspect()
click to toggle source
Calls superclass method
# File lib/fleck/hash_with_indifferent_access.rb, line 34 def inspect super end
to_s()
click to toggle source
Calls superclass method
Hash#to_s
# File lib/fleck/hash_with_indifferent_access.rb, line 38 def to_s super end
Protected Instance Methods
copy_from(original)
click to toggle source
# File lib/fleck/hash_with_indifferent_access.rb, line 44 def copy_from(original) original.each do |key, value| self[key] = self.class.convert_value(value) end end