Sha256: 51546a3def91f04167d560703a812493c70d4be5915794a1b04729a7b0f9e771

Contents?: true

Size: 732 Bytes

Versions: 14

Compression:

Stored size: 732 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

module Mongoid

  # This module contains all the behavior for Ruby implementations of MongoDB
  # selectors.
  #
  # @since 4.0.0
  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.
    #
    # @since 1.0.0
    def _matches?(selector)
      Matcher::Expression.matches?(self, selector)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mongoid-7.3.5 lib/mongoid/matchable.rb
mongoid-7.3.4 lib/mongoid/matchable.rb
mongoid-7.2.6 lib/mongoid/matchable.rb
mongoid-7.3.3 lib/mongoid/matchable.rb
mongoid-7.3.2 lib/mongoid/matchable.rb
mongoid-7.2.5 lib/mongoid/matchable.rb
mongoid-7.2.4 lib/mongoid/matchable.rb
mongoid-7.3.1 lib/mongoid/matchable.rb
mongoid-7.3.0 lib/mongoid/matchable.rb
mongoid-7.2.3 lib/mongoid/matchable.rb
mongoid-7.2.2 lib/mongoid/matchable.rb
mongoid-7.2.1 lib/mongoid/matchable.rb
mongoid-7.2.0 lib/mongoid/matchable.rb
mongoid-7.2.0.rc1 lib/mongoid/matchable.rb