Sha256: 2260ea99e4737f9f6938e89e8b0f1d7597990345a2230cb76feca430f1f18be8

Contents?: true

Size: 668 Bytes

Versions: 9

Compression:

Stored size: 668 Bytes

Contents

# frozen_string_literal: true

module Mongoid

  # This module contains all the behavior for Ruby implementations of MongoDB
  # selectors.
  module Matchable
    extend ActiveSupport::Concern

    # Determines if this document has the attributes to match the supplied
    # MongoDB selector. Used for matching on embedded associations.
    #
    # @example Does the document match?
    #   document._matches?(:title => { "$in" => [ "test" ] })
    #
    # @param [ Hash ] selector The MongoDB selector.
    #
    # @return [ true, false ] True if matches, false if not.
    def _matches?(selector)
      Matcher::Expression.matches?(self, selector)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mongoid-7.5.4 lib/mongoid/matchable.rb
mongoid-7.5.3 lib/mongoid/matchable.rb
mongoid-7.5.2 lib/mongoid/matchable.rb
mongoid-7.5.1 lib/mongoid/matchable.rb
mongoid-7.4.3 lib/mongoid/matchable.rb
mongoid-8.0.1 lib/mongoid/matchable.rb
mongoid-7.5.0 lib/mongoid/matchable.rb
mongoid-7.4.1 lib/mongoid/matchable.rb
mongoid-7.4.0 lib/mongoid/matchable.rb