2018-10-06 19:10:08 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-12-15 09:51:16 -05:00
|
|
|
module Banzai
|
|
|
|
module Pipeline
|
2015-10-21 06:18:23 -04:00
|
|
|
module CombinedPipeline
|
|
|
|
def self.new(*pipelines)
|
2015-12-15 09:51:16 -05:00
|
|
|
Class.new(BasePipeline) do
|
2015-10-21 06:18:23 -04:00
|
|
|
const_set :PIPELINES, pipelines
|
|
|
|
|
2015-12-08 06:29:48 -05:00
|
|
|
def self.pipelines
|
|
|
|
self::PIPELINES
|
|
|
|
end
|
|
|
|
|
2015-10-21 06:18:23 -04:00
|
|
|
def self.filters
|
2016-03-01 15:54:35 -05:00
|
|
|
FilterArray.new(pipelines.flat_map(&:filters))
|
2015-10-21 06:18:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.transform_context(context)
|
2015-12-08 06:29:48 -05:00
|
|
|
pipelines.reduce(context) do |context, pipeline|
|
|
|
|
pipeline.transform_context(context)
|
|
|
|
end
|
2015-10-21 06:18:23 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|