class Mongoid::Matchable::Exists

Checks for existence.

Public Instance Methods

_matches?(value) click to toggle source

Return true if the attribute exists and checking for existence or return true if the attribute does not exist and checking for non-existence.

@example Does anything exist?

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

@param [ Hash ] value The values to check.

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

# File lib/mongoid/matchable/exists.rb, line 20
def _matches?(value)
  @attribute.nil? != value.values.first
end