Class: Dynamicloud::API::Criteria::NotEqualCondition

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

Overview

This class represents a not equal condition left != ‘%som%thing%’

Author:

  • Eleazar Gomez

Since:

  • 8/23/15

Version:

  • 1.0.0

Constant Summary

Constants inherited from Condition

Condition::ROOT, Condition::WITHOUT

Instance Method Summary collapse

Constructor Details

#initialize(left, right) ⇒ NotEqualCondition

Constructor tha builds this condition

Parameters:

  • left

    attribute to compare

  • right

    right part of this condition

Since:

  • 8/23/15



313
314
315
316
# File 'lib/dynamic_criteria.rb', line 313

def initialize(left, right)
  @left = left
  @right = right
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

Since:

  • 8/23/15



321
322
323
# File 'lib/dynamic_criteria.rb', line 321

def to_record_string(parent)
  '"$ne" : {"' + @left + '" : ' + (@right.is_a?(String) ? '"' : '') + (@right.to_s) + (@right.is_a?(String) ? '"' : '') + '}'
end