combined_pipeline.rb 569 Bytes
Newer Older
1 2
module Banzai
  module Pipeline
3 4
    module CombinedPipeline
      def self.new(*pipelines)
5
        Class.new(BasePipeline) do
6 7
          const_set :PIPELINES, pipelines

8 9 10 11
          def self.pipelines
            self::PIPELINES
          end

12
          def self.filters
13
            FilterArray.new(pipelines.flat_map(&:filters))
14 15 16
          end

          def self.transform_context(context)
17 18 19
            pipelines.reduce(context) do |context, pipeline|
              pipeline.transform_context(context)
            end
20 21 22 23 24 25
          end
        end
      end
    end
  end
end