class Dynamicloud::API::Criteria::ORCondition
This class represents an or condition. Implements condition to return a JSON according left and right parts. @author Eleazar Gomez @version 1.0.0 @since 8/23/15
Public Class Methods
new(left, right)
click to toggle source
Constructor tha builds this condition @param left attribute to compare @param right right part of this or condition
# File lib/dynamic_criteria.rb, line 361 def initialize(left, right) unless (left.is_a?(Condition)) || (right.is_a?(Condition)) raise 'left and right should implement Condition' end @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 373 def to_record_string(parent) (parent.is_a?(ORCondition) ? '' : '"$or": {') + @left.to_record_string(self) + ',' + @right.to_record_string(self) + (parent.is_a?(ORCondition) ? '' : '}') end