class Dynamicloud::API::Criteria::EqualCondition
End of ANDCondition
class
Public Class Methods
new(left, right, greater_lesser = '-')
click to toggle source
This constructor will build an equal condition using left and right parts. @param left left part of this equal condition @param right right part of this equal condition
# 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
Public Instance Methods
to_record_string(parent)
click to toggle source
This method will return a String of this condition @param parent this is the parent of this condition @return a json
# 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