Class: Origin::Key

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

Instance Method Summary collapse

Instance Method Details

#eql?(other) ⇒ Boolean


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

def eql?(other)
  self == other
end

#hashObject


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

def hash
  name.hash ^ operator.hash
end

#to_mongo_operatorObject


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

def to_mongo_operator
  MongoModel::MongoOperator.new(name, operator.sub(/^\$/, ""))
end

#to_mongo_order_clauseObject


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

def to_mongo_order_clause
  MongoModel::MongoOrder::Clause.new(name, operator == 1 ? :ascending : :descending)
end