class Hash
Extensions to the core Hash class
def slice(*keys)
-
(Hash)
- hash containing only the keys given.
def slice(*keys) h = {} keys.each { |k| h[k] = self[k] if key?(k) } h end
Extensions to the core Hash class
(Hash)
- hash containing only the keys given.
def slice(*keys) h = {} keys.each { |k| h[k] = self[k] if key?(k) } h end