Sha256: 4e9aacfee3a1a7409a254ca5c103cbc700949e205f28426f3fe921b0ec640953

Contents?: true

Size: 285 Bytes

Versions: 3

Compression:

Stored size: 285 Bytes

Contents

module Moysklad::Resources::WhereFilter
  def where filter
    values.select { |v| filtered? v, filter }
  end

  def findWhere filter
    where(filter).first
  end

  private

  def filtered? o, filter={}
    filter.select { |k,v| o.send(k)==v }.count == filter.keys.count
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
moysklad-0.1.3 lib/moysklad/resources/where_filter.rb
moysklad-0.1.2 lib/moysklad/resources/where_filter.rb
moysklad-0.1.1 lib/moysklad/resources/where_filter.rb