Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/pipeline_toolkit/util/hash_ext.rb

Direct Known Subclasses

IndifferentHash

Instance Method Summary collapse

Instance Method Details

#except_keys(*exception_keys) ⇒ Object



10
11
12
13
14
# File 'lib/pipeline_toolkit/util/hash_ext.rb', line 10

def except_keys(*exception_keys)
  h = {}
  (self.keys - exception_keys).each { |key| h[key] = self[key] }
  h
end

#select_keys(*keys) ⇒ Object



3
4
5
6
7
8
# File 'lib/pipeline_toolkit/util/hash_ext.rb', line 3

def select_keys(*keys)
  h = {}
  self.each do |key, value|
    h[key] = value if keys.include?(key)
  end
end