Class: Itiel::Lookup::DatabaseTable
- Inherits:
-
Object
- Object
- Itiel::Lookup::DatabaseTable
- Includes:
- DB::SQLConnectable, ChainedStep, HashLookup
- Defined in:
- lib/itiel/lookup/database_table.rb
Overview
Joins the main data stream with another lookup stream and appends the specified columns from the lookup stream to the input stream.
Example:
Set up a lookup to the authors table:
Join the “author_name” column on the input stream with the “name” column in the lookup stream.
Join the “id” column in the lookup stream as “author_id”
Instance Attribute Summary collapse
-
#table_name ⇒ Object
Returns the value of attribute table_name.
Attributes included from DB::SQLConnectable
#connection, #connection_file_path
Attributes included from HashLookup
#joined_columns, #lookup_columns
Instance Method Summary collapse
Methods included from DB::SQLConnectable
Methods included from HashLookup
#empty_joined_columns, #lookup!, #lookup_stream
Methods included from ChainedStep
Instance Attribute Details
#table_name ⇒ Object
Returns the value of attribute table_name.
28 29 30 |
# File 'lib/itiel/lookup/database_table.rb', line 28 def table_name @table_name end |
Instance Method Details
#lookup_source ⇒ Object
30 31 32 33 |
# File 'lib/itiel/lookup/database_table.rb', line 30 def lookup_source db = self.class.sequel_connection(connection) db[table_name.to_sym.to_sym].all end |