Class: Prequel::Sql::TableRef

Inherits:
Object
  • Object
show all
Includes:
NamedTableRef
Defined in:
lib/prequel/sql/table_ref.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(relation) ⇒ TableRef

Returns a new instance of TableRef.



8
9
10
11
# File 'lib/prequel/sql/table_ref.rb', line 8

def initialize(relation)
  @relation = relation
  @query_columns = {}
end

Instance Attribute Details

#query_columnsObject (readonly)

Returns the value of attribute query_columns.



5
6
7
# File 'lib/prequel/sql/table_ref.rb', line 5

def query_columns
  @query_columns
end

#relationObject (readonly)

Returns the value of attribute relation.



5
6
7
# File 'lib/prequel/sql/table_ref.rb', line 5

def relation
  @relation
end

Instance Method Details

#build_tuple(field_values) ⇒ Object



21
22
23
# File 'lib/prequel/sql/table_ref.rb', line 21

def build_tuple(field_values)
  tuple_class.new(extract_field_values(field_values))
end

#resolve_column(column) ⇒ Object



17
18
19
# File 'lib/prequel/sql/table_ref.rb', line 17

def resolve_column(column)
  query_columns[column] ||= Sql::QueryColumn.new(self, column.name)
end

#to_sqlObject



13
14
15
# File 'lib/prequel/sql/table_ref.rb', line 13

def to_sql
  name
end