Class: Dynamicloud::API::Criteria::EqualCondition
- Defined in:
- lib/dynamic_criteria.rb
Overview
End of ANDCondition class
Constant Summary
Constants inherited from Condition
Condition::ROOT, Condition::WITHOUT
Instance Method Summary collapse
-
#initialize(left, right, greater_lesser = '-') ⇒ EqualCondition
constructor
This constructor will build an equal condition using left and right parts.
-
#to_record_string(parent) ⇒ Object
This method will return a String of this condition.
Constructor Details
#initialize(left, right, greater_lesser = '-') ⇒ EqualCondition
This constructor will build an equal condition using left and right parts.
108 109 110 111 112 113 |
# File 'lib/dynamic_criteria.rb', line 108 def initialize(left, right, greater_lesser = '-') @left = left @right = right @need_quotes = right.is_a? String @greater_lesser = greater_lesser end |
Instance Method Details
#to_record_string(parent) ⇒ Object
This method will return a String of this condition
118 119 120 121 122 123 124 125 |
# File 'lib/dynamic_criteria.rb', line 118 def to_record_string(parent) if @greater_lesser == '-' return '"' + @left.to_s + '" : ' + (@need_quotes ? '"' : '') + @right.to_s + (@need_quotes ? '"' : ''); end '"' + @left.to_s + '" : { ' + (@greater_lesser == '>' ? '"$gte": ' : '"$lte": ') + (@need_quotes ? '"' : '') + @right.to_s + (@need_quotes ? '"' : '') + ' }' end |