Class: Prequel::Sql::TableRef
- Inherits:
-
Object
- Object
- Prequel::Sql::TableRef
- Includes:
- NamedTableRef
- Defined in:
- lib/prequel/sql/table_ref.rb
Instance Attribute Summary collapse
-
#query_columns ⇒ Object
readonly
Returns the value of attribute query_columns.
-
#relation ⇒ Object
readonly
Returns the value of attribute relation.
Instance Method Summary collapse
- #build_tuple(field_values) ⇒ Object
-
#initialize(relation) ⇒ TableRef
constructor
A new instance of TableRef.
- #resolve_column(column) ⇒ Object
- #to_sql ⇒ Object
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_columns ⇒ Object (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 |
#relation ⇒ Object (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_sql ⇒ Object
13 14 15 |
# File 'lib/prequel/sql/table_ref.rb', line 13 def to_sql name end |