Class: Mongoid::Oslc::Grammar::Operator

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/mongoid/oslc/grammar.rb

Constant Summary collapse

OPERATORS =
{
  "="   => "$in",
  "!="  => "$ne",
  ">"   => "$gt",
  ">="  => "$gte",
  "<"   => "$lt",
  "<="  => "$lte",
  "in"  => "$in"
}

Instance Method Summary collapse

Instance Method Details

#to_mongo_query_with_value(value) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/mongoid/oslc/grammar.rb', line 23

def to_mongo_query_with_value(value)
  if text_value == "="
    value
  else
    { OPERATORS[text_value] => value }
  end
end