Module: MongoDoc::Matchers

Defined in:
lib/mongodoc/matchers.rb

Instance Method Summary collapse

Instance Method Details

#matches?(selector) ⇒ Boolean

Determines if this document has the attributes to match the supplied MongoDB selector. Used for matching on embedded associations.

Returns:

  • (Boolean)


17
18
19
20
21
22
# File 'lib/mongodoc/matchers.rb', line 17

def matches?(selector)
  selector.each_pair do |key, value|
    return false unless matcher(key, value).matches?(value)
  end
  true
end