module MWO::CollectionUtils

Public Instance Methods

filter(options = {}) click to toggle source
# File lib/mwo/collection_utils.rb, line 2
def filter(options = {})
  filtered = self.find_all do |element|
    matches = options.find_all do |k,v|
      element.send(k) == options[k]
    end
    !matches.empty?
  end

  filtered
end