Sha256: f5531a5094e5a3ffae9b43ee340ca48ead798d6bf6ac303236dad0e8d5c5de89

Contents?: true

Size: 356 Bytes

Versions: 2

Compression:

Stored size: 356 Bytes

Contents

module BSFlow
  class Pipeline
    def initialize(*args, procs: [])
      @procs = args + procs
    end
    
    def call(*args)
      output = @procs[0].call(*args)
      if @procs.length == 1
        return output
      else
        @procs[1..-1].each do |proc|
          output = proc.call(output)
        end
        output
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bsflow-2.6.0 lib/bsflow/pipeline.rb
bsflow-2.5.0 lib/bsflow/pipeline.rb