class Egalite::StringifyHash
Public Class Methods
create(values)
click to toggle source
# File lib/egalite/stringify_hash.rb, line 6 def self.create(values) hash = self.new hash.update(values) hash end
Public Instance Methods
[](k)
click to toggle source
Calls superclass method
# File lib/egalite/stringify_hash.rb, line 11 def [](k) super(stringify(k)) end
[]=(k,v)
click to toggle source
Calls superclass method
# File lib/egalite/stringify_hash.rb, line 14 def []=(k,v) super(stringify(k),v) end
delete(key)
click to toggle source
Calls superclass method
# File lib/egalite/stringify_hash.rb, line 50 def delete(key) super(stringify(key)) end
dup()
click to toggle source
# File lib/egalite/stringify_hash.rb, line 42 def dup StringifyHash.create(self) end
fetch(key, *extras)
click to toggle source
Calls superclass method
# File lib/egalite/stringify_hash.rb, line 34 def fetch(key, *extras) super(stringify(key), *extras) end
key?(key)
click to toggle source
Calls superclass method
# File lib/egalite/stringify_hash.rb, line 26 def key?(key) super(stringify(key)) end
merge(hash)
click to toggle source
# File lib/egalite/stringify_hash.rb, line 46 def merge(hash) dup.update(hash) end
to_hash()
click to toggle source
update(hash)
click to toggle source
Calls superclass method
# File lib/egalite/stringify_hash.rb, line 17 def update(hash) newhash = {} hash.each { |k,v| newhash[stringify(k)] = v } super(newhash) end
Also aliased as: merge!
values_at(*indices)
click to toggle source
# File lib/egalite/stringify_hash.rb, line 38 def values_at(*indices) indices.collect {|key| self[key]} end
Private Instance Methods
stringify(key)
click to toggle source
# File lib/egalite/stringify_hash.rb, line 59 def stringify(key) key.kind_of?(Symbol) ? key.to_s : key end