Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/nodule/monkeypatch.rb

Instance Method Summary collapse

Instance Method Details

#fuzzy_filter(h) ⇒ Object



2
3
4
5
6
7
# File 'lib/nodule/monkeypatch.rb', line 2

def fuzzy_filter(h)
  keep_if do |item|
    raise "All elements in this array need to be of type Hash: (#{item.class}) #{item.inspect}" if item.class != Hash
    h.keys.all? { |k| h[k] === item[k] }
  end
end