Class: SymbolOperator
Instance Method Summary collapse
-
#initialize(field, operator, options = {}) ⇒ SymbolOperator
constructor
A new instance of SymbolOperator.
- #to_mm_criteria(value) ⇒ Object
- #to_mm_order ⇒ Object
Constructor Details
#initialize(field, operator, options = {}) ⇒ SymbolOperator
Returns a new instance of SymbolOperator.
167 168 169 |
# File 'lib/mongo_mapper/support.rb', line 167 def initialize(field, operator, ={}) @field, @operator = field, operator end |
Instance Method Details
#to_mm_criteria(value) ⇒ Object
171 172 173 |
# File 'lib/mongo_mapper/support.rb', line 171 def to_mm_criteria(value) {MongoMapper::FinderOptions.normalized_field(@field) => {"$#{@operator}" => value}} end |
#to_mm_order ⇒ Object
175 176 177 |
# File 'lib/mongo_mapper/support.rb', line 175 def to_mm_order [@field.to_s, MongoMapper::FinderOptions.normalized_order_direction(@operator)] end |