Class: Chicago::ETL::Pipeline
- Inherits:
-
Object
- Object
- Chicago::ETL::Pipeline
- Defined in:
- lib/chicago/etl/pipeline.rb
Overview
An ETL pipeline.
Instance Attribute Summary collapse
-
#stages ⇒ Object
readonly
Returns all the defined stages.
Instance Method Summary collapse
- #build_stage(name, options, &block) ⇒ Object
-
#define_stage(*args, &block) ⇒ Object
Defines a generic stage in the pipeline.
-
#initialize(db, schema, &block) ⇒ Pipeline
constructor
Creates a pipeline for a Schema.
Constructor Details
#initialize(db, schema, &block) ⇒ Pipeline
Creates a pipeline for a Schema.
9 10 11 12 13 |
# File 'lib/chicago/etl/pipeline.rb', line 9 def initialize(db, schema, &block) @schema, @db = schema, db @stages = Chicago::Schema::NamedElementCollection.new @builder_class_factory = block || lambda {|name, | StageBuilder } end |
Instance Attribute Details
#stages ⇒ Object (readonly)
Returns all the defined stages.
6 7 8 |
# File 'lib/chicago/etl/pipeline.rb', line 6 def stages @stages end |
Instance Method Details
#build_stage(name, options, &block) ⇒ Object
32 33 34 |
# File 'lib/chicago/etl/pipeline.rb', line 32 def build_stage(name, , &block) builder(name, ).build(name, , &block) end |
#define_stage(*args, &block) ⇒ Object
Defines a generic stage in the pipeline.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/chicago/etl/pipeline.rb', line 16 def define_stage(*args, &block) = args.last.kind_of?(Hash) ? args.pop : {} if args.last.kind_of?(Stage) stage = args.pop name = StageName.new(args) else name = StageName.new(args) stage = build_stage(name, , &block) end stage.name = StageName.new(args) @stages << stage end |