Class: SymbolOperator

Inherits:
Object
  • Object
show all
Defined in:
lib/mongomodel/compatibility/mongo_mapper.rb

Instance Method Summary collapse

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:


10
11
12
# File 'lib/mongomodel/compatibility/mongo_mapper.rb', line 10

def eql?(other)
  self == other
end

#hashObject


14
15
16
# File 'lib/mongomodel/compatibility/mongo_mapper.rb', line 14

def hash
  field.hash ^ operator.hash
end

#to_mongo_operatorObject


2
3
4
# File 'lib/mongomodel/compatibility/mongo_mapper.rb', line 2

def to_mongo_operator
  MongoModel::MongoOperator.new(field, operator)
end

#to_mongo_order_clauseObject


6
7
8
# File 'lib/mongomodel/compatibility/mongo_mapper.rb', line 6

def to_mongo_order_clause
  MongoModel::MongoOrder::Clause.new(field, operator.to_s == 'asc' ? :ascending : :descending)
end