Class: Dynamicloud::API::Criteria::LikeCondition

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

Overview

This class represents a like condition left like ‘%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, not_like = false) ⇒ LikeCondition

This constructor will build a like condition using left and right part.

Parameters:

  • left

    left part of this like condition.

  • right

    right part of this like condition.

Since:

  • 8/23/15



289
290
291
292
293
# File 'lib/dynamic_criteria.rb', line 289

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



298
299
300
# File 'lib/dynamic_criteria.rb', line 298

def to_record_string(parent)
  '"' + @left + '": { "$' + (@not_like ? 'n' : '') + 'like" : ' + '"' + @right + '"' + ' }'
end