Module: Shackleton::Extensions::HashSlice

Defined in:
lib/shackleton/extensions/hash_slice.rb

Instance Method Summary collapse

Instance Method Details

#except(*keys) ⇒ Object



7
8
9
10
# File 'lib/shackleton/extensions/hash_slice.rb', line 7

def except(*keys)
  desired_keys = self.keys - keys
  ::Hash[[desired_keys, self.values_at(*desired_keys)].transpose]
end

#slice(*keys) ⇒ Object



4
5
6
# File 'lib/shackleton/extensions/hash_slice.rb', line 4

def slice(*keys)
  ::Hash[[keys, self.values_at(*keys)].transpose]
end