Module: Sequel::SymbolAref

Included in:
Symbol
Defined in:
lib/sequel/extensions/symbol_aref.rb,
lib/sequel/extensions/symbol_aref_refinement.rb

Overview

The symbol_aref extension makes Symbol#[] support Symbol, Sequel::SQL::Identifier, and Sequel::SQL::QualifiedIdentifier instances, returning appropriate Sequel::SQL::QualifiedIdentifier instances. It's designed as a shortcut so that instead of:

Sequel[:table][:column] # table.column

you can just write:

:table[:column] # table.column

To load the extension:

Sequel.extension :symbol_aref

There is a refinement version of this in the symbol_aref_refinement extension.

Related module: Sequel::SymbolAref

Instance Method Summary collapse

Instance Method Details

#[](v) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/sequel/extensions/symbol_aref.rb', line 23

def [](v)
  case v
  when Symbol, Sequel::SQL::Identifier, Sequel::SQL::QualifiedIdentifier
    Sequel::SQL::QualifiedIdentifier.new(self, v)
  else
    super
  end
end