Sha256: 2a7af7918335961fc9bdfa5b24fa2d55d6d327113f3dec35011f27313ffca520
Contents?: true
Size: 379 Bytes
Versions: 16
Compression:
Stored size: 379 Bytes
Contents
class Cistern::Hash def self.slice(hash, *keys) {}.tap do |sliced| keys.each{ |k| sliced[k] = hash[k] if hash.key?(k) } end end def self.stringify_keys(object) case object when Hash object.inject({}){|r,(k,v)| r.merge(k.to_s => stringify_keys(v))} when Array object.map{|v| stringify_keys(v) } else object end end end
Version data entries
16 entries across 16 versions & 1 rubygems