Class: Dynamicloud::API::Criteria::NullCondition

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

Overview

This class represents an is null or is not null condition.

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, is_not_null = false) ⇒ NullCondition

Constructor tha builds this condition

Parameters:

  • left

    attribute to compare

  • is_not_null (defaults to: false)

    flag that indicates what kind of comparison.

Since:

  • 8/23/15



336
337
338
339
# File 'lib/dynamic_criteria.rb', line 336

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



344
345
346
# File 'lib/dynamic_criteria.rb', line 344

def to_record_string(parent)
  '"' + @left + '": {' + (@is_not_null ? '"$notNull"' : '"$null"') + ': "1"}';
end