Module: Cassie::Statements::Statement::Relations::ClassMethods
Instance Method Summary collapse
-
#relations_args ⇒ Object
The enumeration of current relations’ parameters that will be used to build Relation objects when the statement is built.
-
#where(identifier, operation, opts = {}) ⇒ Enumerable<Array<Object>>
DSL to set a ranging relation (
WHERE
clause) for the statement.
Instance Method Details
#relations_args ⇒ Object
The enumeration of current relations’ parameters that will be used to build Relation objects when the statement is built
55 56 57 |
# File 'lib/cassie/statements/statement/relations.rb', line 55 def relations_args @relations_args ||= [] end |
#where(identifier, operation, opts = {}) ⇒ Enumerable<Array<Object>>
DSL to set a ranging relation (WHERE
clause) for the statement.
Defining a relation 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 relation.
45 46 47 48 49 50 51 |
# File 'lib/cassie/statements/statement/relations.rb', line 45 def where(identifier, operation, opts={}) opts[:value] ||= implied_argument_method(identifier, operation) define_argument_accessor(opts[:value]) relations_args << [identifier, operation, opts.delete(:value), opts] end |