Class: Babik::QuerySet::Update::Assignment::Function

Inherits:
Object
  • Object
show all
Defined in:
lib/babik/queryset/lib/update/assignment.rb

Overview

Represents a function operator that can be used in an UPDATE For example:

UPDATE SET stars = ABS(stars)

Instance Method Summary collapse

Constructor Details

#initialize(field, function_call) ⇒ Function

Returns a new instance of Function.



48
49
50
51
# File 'lib/babik/queryset/lib/update/assignment.rb', line 48

def initialize(field, function_call)
  @field = field
  @function_call = function_call
end

Instance Method Details

#sql_valueString

Return the right part of the assignment of the UPDATE statement.

Returns:

  • (String)

    right part of the assignment with the format defined by the function_call attribute.



55
56
57
# File 'lib/babik/queryset/lib/update/assignment.rb', line 55

def sql_value
  @function_call
end