Class: Sequel::SQL::Subscript
- Inherits:
-
Expression
- Object
- Expression
- Sequel::SQL::Subscript
- Defined in:
- lib/sequel_core/sql.rb
Overview
Represents an SQL array access, with multiple possible arguments.
Constant Summary
Constants included from ColumnMethods
ColumnMethods::AS, ColumnMethods::ASC, ColumnMethods::DESC
Instance Attribute Summary collapse
-
#f ⇒ Object
readonly
The SQL array column.
-
#sub ⇒ Object
readonly
The array of subscripts to use (should be an array of numbers).
Instance Method Summary collapse
-
#initialize(f, sub) ⇒ Subscript
constructor
Set the attributes to the given arguments.
-
#to_s(ds) ⇒ Object
Delegate the creation of the resulting SQL to the given dataset, since it may be database dependent.
-
#|(sub) ⇒ Object
Create a new subscript appending the given subscript(s) the the current array of subscripts.
Methods inherited from Expression
Methods included from ColumnMethods
Constructor Details
#initialize(f, sub) ⇒ Subscript
Set the attributes to the given arguments
475 476 477 |
# File 'lib/sequel_core/sql.rb', line 475 def initialize(f, sub) @f, @sub = f, sub end |
Instance Attribute Details
#f ⇒ Object (readonly)
The SQL array column
469 470 471 |
# File 'lib/sequel_core/sql.rb', line 469 def f @f end |
#sub ⇒ Object (readonly)
The array of subscripts to use (should be an array of numbers)
472 473 474 |
# File 'lib/sequel_core/sql.rb', line 472 def sub @sub end |
Instance Method Details
#to_s(ds) ⇒ Object
Delegate the creation of the resulting SQL to the given dataset, since it may be database dependent.
487 488 489 |
# File 'lib/sequel_core/sql.rb', line 487 def to_s(ds) ds.subscript_sql(self) end |