Class: Seaquel::AST::Table

Inherits:
Expression show all
Defined in:
lib/seaquel/ast/table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Expression

#asc, binop, #desc, joinop, #lisp_inspect, unaryop

Constructor Details

#initialize(name) ⇒ Table

Returns a new instance of Table.



5
6
7
# File 'lib/seaquel/ast/table.rb', line 5

def initialize name
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/seaquel/ast/table.rb', line 3

def name
  @name
end

Instance Method Details

#[](col_name) ⇒ Object

Returns a table column.



19
20
21
# File 'lib/seaquel/ast/table.rb', line 19

def [] col_name
  Column.new(col_name, self)
end

#as(name) ⇒ Object

Returns a table alias.



25
26
27
# File 'lib/seaquel/ast/table.rb', line 25

def as name
  TableAlias.new(self, name)
end

#as_column_prefix(quoter) ⇒ Object

Returns the identifier that designates the table uniquely in the query as a prefix for column references. (“foo”.“a”)



32
33
34
# File 'lib/seaquel/ast/table.rb', line 32

def as_column_prefix quoter
  quote(quoter)
end

#inspectObject



36
37
38
# File 'lib/seaquel/ast/table.rb', line 36

def inspect
  lisp_inspect(:table, name)
end

#quote(quoter) ⇒ Object



13
14
15
# File 'lib/seaquel/ast/table.rb', line 13

def quote quoter
  quoter.table(name)
end

#visit(visitor) ⇒ Object



9
10
11
# File 'lib/seaquel/ast/table.rb', line 9

def visit visitor
  visitor.visit_table(self)
end