Class: Mongoid::Matchers::Default

Inherits:
Object
  • Object
show all
Defined in:
lib/mongoid/matchers/default.rb

Direct Known Subclasses

All, Exists, Gt, Gte, In, Lt, Lte, Ne, Nin, Size

Instance Method Summary collapse

Constructor Details

#initialize(attribute) ⇒ Default

Creating a new matcher only requires the value.



6
7
8
# File 'lib/mongoid/matchers/default.rb', line 6

def initialize(attribute)
  @attribute = attribute
end

Instance Method Details

#matches?(value) ⇒ Boolean

Return true if the attribute and value are equal.

Returns:

  • (Boolean)


10
11
12
# File 'lib/mongoid/matchers/default.rb', line 10

def matches?(value)
  @attribute == value
end