class Sequel::SQL::Subscript
Represents an SQL
array access, with multiple possible arguments.
Attributes
expression[R]
The SQL
array column
f[R]
The SQL
array column
sub[R]
The array of subscripts to use (should be an array of numbers)
Public Class Methods
new(expression, sub)
click to toggle source
Set the array column and subscripts to the given arguments
# File lib/sequel/sql.rb 1807 def initialize(expression, sub) 1808 @expression = expression 1809 @sub = sub 1810 freeze 1811 end
Public Instance Methods
[](sub)
click to toggle source
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]
# File lib/sequel/sql.rb 1827 def [](sub) 1828 Subscript.new(self, Array(sub)) 1829 end
|(sub)
click to toggle source
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]
# File lib/sequel/sql.rb 1818 def |(sub) 1819 Subscript.new(@expression, @sub + Array(sub)) 1820 end