class Mongoid::Matchable::In

Performs matching for any value in an array.

Public Instance Methods

_matches?(value) click to toggle source

Return true if the attribute is in the values.

@example Do the values match?

matcher._matches?({ :key => 10 })

@param [ Hash ] value The values to check.

@return [ true, false ] If a value exists.

# File lib/mongoid/matchable/in.rb, line 16
def _matches?(value)
  attribute_array = @attribute.nil? ? [nil] : Array.wrap(@attribute)
  value.values.first.any? do |e|
    attribute_array.any? { |_attribute| e === _attribute }
  end
end