Sha256: af20dd7f241bd3435cac8387e2f2c3748bc0c298e6983e0539df5423cd57fc67

Contents?: true

Size: 241 Bytes

Versions: 6

Compression:

Stored size: 241 Bytes

Contents

module MWO::CollectionUtils
  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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mwo-1.0.0 lib/mwo/collection_utils.rb
mwo-0.1.2 lib/mwo/collection_utils.rb
mwo-0.1.1 lib/mwo/collection_utils.rb
mwo-0.1.0 lib/mwo/collection_utils.rb
mwo-0.0.3 lib/mwo/collection_utils.rb
mwo-0.0.2 lib/mwo/collection_utils.rb