Sha256: 7e94b07fb7123d29526be9be0014e8f48bacb05f30a954e731df0857504aaea4
Contents?: true
Size: 450 Bytes
Versions: 1
Compression:
Stored size: 450 Bytes
Contents
class Hash def symbolize_keys(&select) dup.symbolize_keys!(&select) end def symbolize_keys!(&select) if select keys.each do |key| if select[key] new_key = (key.to_sym rescue key.to_s.to_sym) self[new_key] = delete(key) end end else keys.each do |key| new_key = (key.to_sym rescue key.to_s.to_sym) self[new_key] = delete(key) end end self end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fozzie-1.0.2 | lib/core_ext/hash/symbolize_keys.rb |