class Babik::QuerySet::Update::Assignment::Operation

Represents a table field. It will be used when an update field is based on its value an nothing else. For example:

UPDATE SET stars = stars + 1

Public Class Methods

new(field, operation, value) click to toggle source
# File lib/babik/queryset/lib/update/assignment.rb, line 64
def initialize(field, operation, value)
  @field = field
  @operation = operation
  @value = value
end

Public Instance Methods

sql_value() click to toggle source

Return the right part of the assignment of the UPDATE statement. @return [String] right part of the assignment with the format <field> <operation> <value>.

# File lib/babik/queryset/lib/update/assignment.rb, line 72
def sql_value
  "#{@field} #{@operation} #{@value}"
end