class Mashed::StringyHash

Public Class Methods

stringify(object) click to toggle source
# File lib/mashed/stringy_hash.rb, line 5
def self.stringify(object)
  if object.is_a?(Array)
    object.map { |value| StringyHash.stringify(value) }
  elsif object.is_a?(Hash)
    StringyHash.new(object.each_with_object({}) do |(k,v), h|
      h[k.to_s] = StringyHash.stringify(v)
    end)
  else
    object
  end
end

Public Instance Methods

[](key) click to toggle source
Calls superclass method
# File lib/mashed/stringy_hash.rb, line 21
def [](key)
  super(key.to_s)
end
[]=(key, value) click to toggle source
Calls superclass method
# File lib/mashed/stringy_hash.rb, line 25
def []=(key, value)
  super(key.to_s, value)
end
Also aliased as: store
delete(key, &blk) click to toggle source
Calls superclass method
# File lib/mashed/stringy_hash.rb, line 34
def delete(key, &blk)
  super(key.to_s, &blk)
end
key?(key) click to toggle source
Calls superclass method
# File lib/mashed/stringy_hash.rb, line 30
def key?(key)
  super(key.to_s)
end
merge(other_hash, &blk) click to toggle source
Calls superclass method
# File lib/mashed/stringy_hash.rb, line 38
def merge(other_hash, &blk)
  super(self.class.stringify(other_hash), &blk)
end
merge!(other_hash, &blk) click to toggle source
Calls superclass method
# File lib/mashed/stringy_hash.rb, line 42
def merge!(other_hash, &blk)
  super(self.class.stringify(other_hash), &blk)
end
replace(other_hash, &blk) click to toggle source
Calls superclass method
# File lib/mashed/stringy_hash.rb, line 46
def replace(other_hash, &blk)
  super(self.class.stringify(other_hash), &blk)
end
store(key, value)
Alias for: []=
stringify() click to toggle source
# File lib/mashed/stringy_hash.rb, line 17
def stringify
  dup
end
update(other_hash, &blk) click to toggle source
Calls superclass method
# File lib/mashed/stringy_hash.rb, line 50
def update(other_hash, &blk)
  super(self.class.stringify(other_hash), &blk)
end