Class: ETL::Batch::Batch
Instance Attribute Summary (collapse)
-
- (Object) engine
Returns the value of attribute engine.
-
- (Object) file
Returns the value of attribute file.
Class Method Summary (collapse)
-
+ (Object) resolve(batch, engine)
Resolve the given object to an ETL::Control::Control instance.
Instance Method Summary (collapse)
- - (Object) after_execute
- - (Object) before_execute
- - (Object) directives
- - (Object) execute
-
- (Batch) initialize(file)
constructor
A new instance of Batch.
- - (Object) run(file)
- - (Object) use_temp_tables(value = true)
Constructor Details
- (Batch) initialize(file)
A new instance of Batch
74 75 76 |
# File 'lib/etl/batch/batch.rb', line 74 def initialize(file) @file = file end |
Instance Attribute Details
- (Object) engine
Returns the value of attribute engine
36 37 38 |
# File 'lib/etl/batch/batch.rb', line 36 def engine @engine end |
- (Object) file
Returns the value of attribute file
35 36 37 |
# File 'lib/etl/batch/batch.rb', line 35 def file @file end |
Class Method Details
+ (Object) resolve(batch, engine)
Resolve the given object to an ETL::Control::Control instance. Acceptable arguments are:
-
The path to a control file as a String
-
A File object referencing the control file
-
The ETL::Control::Control object (which will just be returned)
Raises a ControlError if any other type is given
46 47 48 49 50 |
# File 'lib/etl/batch/batch.rb', line 46 def resolve(batch, engine) batch = do_resolve(batch) batch.engine = engine batch end |
Instance Method Details
- (Object) after_execute
105 106 107 108 |
# File 'lib/etl/batch/batch.rb', line 105 def after_execute ETL::Engine.finish # TODO: should be moved to the directive? ETL::Engine.use_temp_tables = false # reset the temp tables end |
- (Object) before_execute
101 102 103 |
# File 'lib/etl/batch/batch.rb', line 101 def before_execute end |
- (Object) directives
97 98 99 |
# File 'lib/etl/batch/batch.rb', line 97 def directives @directives ||= [] end |
- (Object) execute
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/etl/batch/batch.rb', line 86 def execute engine.say "Executing batch" before_execute directives.each do |directive| directive.execute end engine.say "Finishing batch" after_execute engine.say "Batch complete" end |
- (Object) run(file)
78 79 80 |
# File 'lib/etl/batch/batch.rb', line 78 def run(file) directives << Run.new(self, file) end |
- (Object) use_temp_tables(value = true)
82 83 84 |
# File 'lib/etl/batch/batch.rb', line 82 def use_temp_tables(value = true) directives << UseTempTables.new(self) end |