Class: Babik::QuerySet::Update::Assignment::Operation
- Inherits:
-
Object
- Object
- Babik::QuerySet::Update::Assignment::Operation
- Defined in:
- lib/babik/queryset/lib/update/assignment.rb
Overview
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
Instance Method Summary collapse
-
#initialize(field, operation, value) ⇒ Operation
constructor
A new instance of Operation.
-
#sql_value ⇒ String
Return the right part of the assignment of the UPDATE statement.
Constructor Details
#initialize(field, operation, value) ⇒ Operation
Returns a new instance of Operation.
64 65 66 67 68 |
# File 'lib/babik/queryset/lib/update/assignment.rb', line 64 def initialize(field, operation, value) @field = field @operation = operation @value = value end |
Instance Method Details
#sql_value ⇒ String
Return the right part of the assignment of the UPDATE statement.
72 73 74 |
# File 'lib/babik/queryset/lib/update/assignment.rb', line 72 def sql_value "#{@field} #{@operation} #{@value}" end |