Class: Symbol

Inherits:
Object show all
Includes:
Sequel::Postgres::ArrayOpMethods, Sequel::Postgres::HStoreOpMethods, Sequel::Postgres::InetOpMethods, Sequel::Postgres::JSONOpMethods, Sequel::Postgres::PGRowOp::ExpressionMethods, Sequel::Postgres::RangeOpMethods, Sequel::SQL::AliasMethods, Sequel::SQL::BooleanMethods, Sequel::SQL::CastMethods, Sequel::SQL::ComplexExpressionMethods, Sequel::SQL::NumericMethods, Sequel::SQL::OrderMethods, Sequel::SQL::QualifyingMethods, Sequel::SQL::StringMethods, Sequel::SQL::SubscriptMethods
Defined in:
lib/sequel/extensions/core_extensions.rb,
lib/sequel/extensions/symbol_as.rb,
lib/sequel/extensions/pg_row_ops.rb,
lib/sequel/extensions/pg_inet_ops.rb,
lib/sequel/extensions/pg_json_ops.rb,
lib/sequel/extensions/symbol_aref.rb,
lib/sequel/extensions/symbol_aref.rb,
lib/sequel/extensions/pg_array_ops.rb,
lib/sequel/extensions/pg_range_ops.rb,
lib/sequel/extensions/pg_hstore_ops.rb

Overview

Sequel extends Symbol to add methods to implement the SQL DSL.

Instance Method Summary collapse

Methods included from Sequel::SQL::ComplexExpressionMethods

#extract, #sql_boolean, #sql_number, #sql_string

Methods included from Sequel::SQL::SubscriptMethods

#sql_subscript

Methods included from Sequel::SQL::StringMethods

#ilike, #like

Methods included from Sequel::SQL::QualifyingMethods

#*, #qualify

Methods included from Sequel::SQL::NumericMethods

#+, #coerce

Methods included from Sequel::SQL::BooleanMethods

#~

Methods included from Sequel::SQL::OrderMethods

#asc, #desc

Methods included from Sequel::SQL::CastMethods

#cast, #cast_numeric, #cast_string

Methods included from Sequel::Postgres::HStoreOpMethods

#hstore

Methods included from Sequel::Postgres::RangeOpMethods

#pg_range

Methods included from Sequel::Postgres::ArrayOpMethods

#pg_array

Methods included from Sequel::Postgres::JSONOpMethods

#pg_json, #pg_jsonb

Methods included from Sequel::Postgres::InetOpMethods

#pg_inet

Methods included from Sequel::Postgres::PGRowOp::ExpressionMethods

#pg_row

Methods included from Sequel::SQL::AliasMethods

#as

Instance Method Details

#[](v) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/sequel/extensions/symbol_aref.rb', line 44

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

#aref_before_sequelObject



41
# File 'lib/sequel/extensions/symbol_aref.rb', line 41

alias_method :aref_before_sequel, :[]

#identifierObject

Returns receiver wrapped in an Sequel::SQL::Identifier.

:a.identifier # SQL: "a"


209
210
211
# File 'lib/sequel/extensions/core_extensions.rb', line 209

def identifier
  Sequel::SQL::Identifier.new(self)
end

#sql_function(*args) ⇒ Object

Returns a Sequel::SQL::Function with this as the function name, and the given arguments.

:now.sql_function # SQL: now()
:sum.sql_function(:a) # SQL: sum(a)
:concat.sql_function(:a, :b) # SQL: concat(a, b)


219
220
221
# File 'lib/sequel/extensions/core_extensions.rb', line 219

def sql_function(*args)
  Sequel::SQL::Function.new(self, *args)
end