Module: Mongoid::Matchers
- Included in:
- Components
- Defined in:
- lib/mongoid/matchers.rb,
lib/mongoid/matchers/gt.rb,
lib/mongoid/matchers/in.rb,
lib/mongoid/matchers/lt.rb,
lib/mongoid/matchers/ne.rb,
lib/mongoid/matchers/or.rb,
lib/mongoid/matchers/all.rb,
lib/mongoid/matchers/and.rb,
lib/mongoid/matchers/gte.rb,
lib/mongoid/matchers/lte.rb,
lib/mongoid/matchers/nin.rb,
lib/mongoid/matchers/size.rb,
lib/mongoid/matchers/exists.rb,
lib/mongoid/matchers/default.rb,
lib/mongoid/matchers/strategies.rb
Overview
:nodoc:
Defined Under Namespace
Modules: Strategies Classes: All, And, Default, Exists, Gt, Gte, In, Lt, Lte, Ne, Nin, Or, Size
Instance Method Summary collapse
-
#matches?(selector) ⇒ true, false
Determines if this document has the attributes to match the supplied MongoDB selector.
Instance Method Details
#matches?(selector) ⇒ true, false
Determines if this document has the attributes to match the supplied MongoDB selector. Used for matching on embedded associations.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mongoid/matchers.rb', line 19 def matches?(selector) selector.each_pair do |key, value| if value.is_a?(Hash) value.each do |item| return false unless Strategies.matcher(self, key, Hash[*item]).matches?(Hash[*item]) end else return false unless Strategies.matcher(self, key, value).matches?(value) end end return true end |