Class: PgSerializable::Nodes::As

Inherits:
Base
  • Object
show all
Defined in:
lib/pg_serializable/nodes/as.rb

Instance Method Summary collapse

Methods inherited from Base

#to_s

Constructor Details

#initialize(scope, table_alias) ⇒ As

Returns a new instance of As.



4
5
6
7
# File 'lib/pg_serializable/nodes/as.rb', line 4

def initialize(scope, table_alias)
  @scope = scope
  @table_alias = table_alias
end

Instance Method Details

#to_sqlObject



9
10
11
# File 'lib/pg_serializable/nodes/as.rb', line 9

def to_sql
  "(#{@scope.respond_to?(:to_sql) ? @scope.to_sql : @scope.to_s}) #{@table_alias}"
end