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 18
def matches?(value)
  @attribute.nil? != value.values.first
end