Class: Sequel::SQL::AliasedExpression

Inherits:
SpecificExpression show all
Defined in:
lib/sequel_core/sql.rb

Overview

Represents an aliasing of an expression/column to a given name.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Expression

#lit

Constructor Details

#initialize(expression, aliaz) ⇒ AliasedExpression

Create an object with the given expression and alias.



390
391
392
# File 'lib/sequel_core/sql.rb', line 390

def initialize(expression, aliaz)
  @expression, @aliaz = expression, aliaz
end

Instance Attribute Details

#aliazObject (readonly)

The alias to use for the expression, not alias since that is a keyword in ruby.



387
388
389
# File 'lib/sequel_core/sql.rb', line 387

def aliaz
  @aliaz
end

#expressionObject (readonly)

The expression to alias



383
384
385
# File 'lib/sequel_core/sql.rb', line 383

def expression
  @expression
end

Instance Method Details

#to_s(ds) ⇒ Object

Delegate the creation of the resulting SQL to the given dataset, since it may be database dependent.



396
397
398
# File 'lib/sequel_core/sql.rb', line 396

def to_s(ds)
  ds.aliased_expression_sql(self)
end