Class: Dynamicloud::API::Criteria::GreaterLesser

Inherits:
Condition
  • Object
show all
Defined in:
lib/dynamic_criteria.rb

Overview

End of ExistsCondition class

Constant Summary

Constants inherited from Condition

Condition::ROOT, Condition::WITHOUT

Instance Method Summary collapse

Constructor Details

#initialize(left, right, greater_lesser) ⇒ GreaterLesser

Returns a new instance of GreaterLesser.



229
230
231
232
233
234
# File 'lib/dynamic_criteria.rb', line 229

def initialize(left, right, greater_lesser)
  @greater_lesser = greater_lesser
  @left = left
  @right = right
  @need_quotes = right.is_a?(String)
end

Instance Method Details

#to_record_string(parent) ⇒ Object

This method will return a String of this condition

Parameters:

  • parent

    this is the parent of this condition

Returns:

  • a json



239
240
241
242
243
244
# File 'lib/dynamic_criteria.rb', line 239

def to_record_string(parent)
  '"' + @left + '": { ' +
      (@greater_lesser == '>' ? '"$gt"' : '"$lt"') + ': ' +
      (@need_quotes ? '"' : '') + @right.to_s + (@need_quotes ? '"' : '') +
      ' }'
end