Module: Mongoid::Matchable

Extended by:
ActiveSupport::Concern
Included in:
Composable
Defined in:
build/mongoid-master/lib/mongoid/matchable.rb

Overview

This module contains all the behavior for Ruby implementations of MongoDB selectors.

Since:

  • 4.0.0

Instance Method Summary collapse

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.

Examples:

Does the document match?

document._matches?(:title => { "$in" => [ "test" ] })

Parameters:

  • selector (Hash)

    The MongoDB selector.

Returns:

  • (true, false)

    True if matches, false if not.

Since:

  • 1.0.0



24
25
26
# File 'build/mongoid-master/lib/mongoid/matchable.rb', line 24

def _matches?(selector)
  Matcher::Expression.matches?(self, selector)
end