Class: Itiel::Load::DatabaseTable
- Inherits:
-
Object
- Object
- Itiel::Load::DatabaseTable
- Includes:
- DB::SQLConnectable, ChainedStep, Nameable
- Defined in:
- lib/itiel/load/database_table.rb
Overview
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 Nameable
Instance Method Summary collapse
-
#initialize(connection, table_name) ⇒ DatabaseTable
constructor
A new instance of DatabaseTable.
- #persist(input_stream) ⇒ Object
- #table ⇒ Object
Methods included from DB::SQLConnectable
Methods included from ChainedStep
Constructor Details
#initialize(connection, table_name) ⇒ DatabaseTable
Returns a new instance of DatabaseTable.
17 18 19 20 |
# File 'lib/itiel/load/database_table.rb', line 17 def initialize(connection, table_name) self.connection = connection self.table_name = table_name end |
Instance Attribute Details
#table_name ⇒ Object
Returns the value of attribute table_name.
15 16 17 |
# File 'lib/itiel/load/database_table.rb', line 15 def table_name @table_name end |
Instance Method Details
#persist(input_stream) ⇒ Object
22 23 24 25 26 |
# File 'lib/itiel/load/database_table.rb', line 22 def persist(input_stream) input_stream.each do |element| table.insert(element) end end |
#table ⇒ Object
28 29 30 31 |
# File 'lib/itiel/load/database_table.rb', line 28 def table @@db ||= self.class.sequel_connection(connection) @@db[table_name.to_sym] end |