Module: Sequel::SQL::SubscriptMethods

Included in:
ComplexExpression, GenericExpression, Symbol
Defined in:
lib/sequel/sql.rb

Overview

This module includes the sql_subscript method, representing SQL array accesses.

Instance Method Summary collapse

Instance Method Details

#sql_subscript(*sub) ⇒ Object

Return a Subscript with the given arguments, representing an SQL array access.

:array.sql_subscript(1) # array[1]
:array.sql_subscript(1, 2) # array[1, 2]
:array.sql_subscript([1, 2]) # array[1, 2]
:array.sql_subscript(:array, 1..2) # array[1:2]
:array.sql_subscript(:array, 1...3) # array[1:2]


928
929
930
# File 'lib/sequel/sql.rb', line 928

def sql_subscript(*sub)
  Subscript.new(self, sub.flatten)
end