Class: LikeCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/tune_my_query/commands/LikeCommand.rb

Overview

LIKE COMMAND # Command for matching and substituting occurences of LIKE in the parameter given # Has one singleton method called ‘execute’ which performs the main function #

#

Class Method Summary collapse

Class Method Details

.execute(condition) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/tune_my_query/commands/LikeCommand.rb', line 7

def execute(condition)
  if condition.is_a?(Array)
    condition.each { |c| execute(c) } # Calling itself on each element if the supplied parameter is an Array
  elsif condition.is_a?(String)
    condition.gsub!(/ ilike /i, " like ") if condition.is_a?(String)
  end
end