Module: Cassie::Statements::Statement::Assignments::ClassMethods
Instance Method Summary collapse
-
#assignments_args ⇒ Object
The enumeration of current assignments’ parameters that will be used to build Assignment objects when the statement is built.
-
#set(identifier, opts = {}) ⇒ Enumerable<Array<Object>>
DSL to set an assigment (
SET
orVALUES
clause) forUPDATE
andINSERT
statements.
Instance Method Details
#assignments_args ⇒ Object
The enumeration of current assignments’ parameters that will be used to build Assignment objects when the statement is built
65 66 67 |
# File 'lib/cassie/statements/statement/assignments.rb', line 65 def assignments_args @assignments_args ||= [] end |
#set(identifier, opts = {}) ⇒ Enumerable<Array<Object>>
DSL to set an assigment (SET
or VALUES
clause) for UPDATE
and INSERT
statements.
Defining an assigment also defines an attr_accessor
with the same name as the identifier (or the :value
option if a symbol is used). The underlying instance variable value for this accessor will be used when determining the value for the assigment.
55 56 57 58 59 60 61 |
# File 'lib/cassie/statements/statement/assignments.rb', line 55 def set(identifier, opts={}) opts[:value] ||= identifier.to_sym define_argument_accessor(opts[:value]) assignments_args << [identifier, opts.delete(:value), opts] end |