Represents an SQL
array access, with multiple possible arguments.
Attributes
expression | [R] |
The |
f | [R] |
The |
sub | [R] |
The array of subscripts to use (should be an array of numbers) |
Public Class methods
new(expression, sub)
Set the array column and subscripts to the given arguments
[show source]
# File lib/sequel/sql.rb 1817 def initialize(expression, sub) 1818 @expression = expression 1819 @sub = sub 1820 freeze 1821 end
Public Instance methods
[](sub)
Create a new Subscript
by accessing a subarray of a multidimensional array.
Sequel[:a].sql_subscript(2) # a[2] Sequel[:a].sql_subscript(2)[1] # a[2][1]
[show source]
# File lib/sequel/sql.rb 1837 def [](sub) 1838 Subscript.new(self, Array(sub)) 1839 end
|(sub)
Create a new Subscript
appending the given subscript(s) to the current array of subscripts.
Sequel[:a].sql_subscript(2) # a[2] Sequel[:a].sql_subscript(2) | 1 # a[2, 1]
[show source]
# File lib/sequel/sql.rb 1828 def |(sub) 1829 Subscript.new(@expression, @sub + Array(sub)) 1830 end