Sha256: 984c87770efbbe8aa1fbd397118715cbe4332f2d25027a1d46c5d6d290421eb6
Contents?: true
Size: 1.53 KB
Versions: 5
Compression:
Stored size: 1.53 KB
Contents
module ETL #:nodoc: module Batch #:nodoc: # Abstract base class for directives class Directive # Method to access the batch object attr_reader :batch # Initialize the directive with the given batch object def initialize(batch) @batch = batch end # Execute the directive def execute do_execute end protected # Implemented by subclasses def do_execute raise RuntimeError, "Directive must implement do_execute method" end end # Directive indicating that the specified ETL control file should be # run class Run < Directive # The file to execute attr_reader :file # Initialize the directive with the given batch object and file def initialize(batch, file) super(batch) @file = file end protected # Execute the process def do_execute current_batch = ETL::Engine.batch batch.engine.process(file) job = ETL::Engine.batch if (job.kind_of? ETL::Execution::Batch and current_batch[:id] != job[:id]) job[:batch_id] = current_batch[:id] job.save! end ETL::Engine.batch = current_batch end end # Directive indicating temp tables should be used. class UseTempTables < Directive def initialize(batch) super(batch) end protected def do_execute ETL::Engine.use_temp_tables = true end end end end
Version data entries
5 entries across 5 versions & 3 rubygems