class Dynamicloud::API::Criteria::BetweenCondition
End of EqualCondition
class
Public Class Methods
new(field, left, right)
click to toggle source
Builds an instance with a specific field whose value should be between left and right
@param field field in this condition @param left left part of the between condition @param right right part of the between condition
# File lib/dynamic_criteria.rb, line 136 def initialize(field, left, right) @field = field @left = left @right = right 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 145 def to_record_string(parent) "\"" + @field + "\": { \"$between\": [" + (transform_left_right) + ']}' end
Private Instance Methods
transform_left_right()
click to toggle source
# File lib/dynamic_criteria.rb, line 150 def transform_left_right result = (@left.is_a?(String) ? ("\"" + @left + "\"") : @left.to_s) result += ',' result + (@right.is_a?(String) ? ("\"" + @right + "\"") : @right.to_s) end