Class: Sequel::SQL::Subscript

Inherits:
GenericExpression show all
Defined in:
lib/sequel/sql.rb

Overview

Represents an SQL array access, with multiple possible arguments.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SubscriptMethods

#sql_subscript

Methods included from StringMethods

#ilike, #like

Methods included from OrderMethods

#asc, #desc

Methods included from ComplexExpressionMethods

#extract, #sql_boolean, #sql_number, #sql_string

Methods included from CastMethods

#cast, #cast_numeric, #cast_string

Methods included from BooleanMethods

#~

Methods included from AliasMethods

#as

Methods inherited from Expression

#==, attr_reader, comparison_attrs, #eql?, #hash, #inspect, #lit, #sql_literal

Constructor Details

#initialize(f, sub) ⇒ Subscript

Set the array column and subscripts to the given arguments



976
977
978
# File 'lib/sequel/sql.rb', line 976

def initialize(f, sub)
  @f, @sub = f, sub
end

Instance Attribute Details

#fObject (readonly)

The SQL array column



970
971
972
# File 'lib/sequel/sql.rb', line 970

def f
  @f
end

#subObject (readonly)

The array of subscripts to use (should be an array of numbers)



973
974
975
# File 'lib/sequel/sql.rb', line 973

def sub
  @sub
end

Instance Method Details

#|(sub) ⇒ Object

Create a new Subscript appending the given subscript(s) the the current array of subscripts.



982
983
984
# File 'lib/sequel/sql.rb', line 982

def |(sub)
  Subscript.new(@f, @sub + Array(sub))
end