Class: Cistern::Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/cistern/hash.rb

Class Method Summary collapse

Class Method Details

.slice(hash, *keys) ⇒ Object



2
3
4
5
6
# File 'lib/cistern/hash.rb', line 2

def self.slice(hash, *keys)
  {}.tap do |sliced|
    keys.each{|k| sliced[k]= hash[k] if hash.key?(k)}
  end
end