Sha256: 565aba50e876fb509a826108c6015b9aa43e0c45535f6c2cbaf31a5694f1dc51

Contents?: true

Size: 339 Bytes

Versions: 3

Compression:

Stored size: 339 Bytes

Contents

module BSFlow
  class Pipeline
    def initialize(procs:)
      @procs = 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

3 entries across 3 versions & 1 rubygems

Version Path
bsflow-2.4.0 lib/bsflow/pipeline.rb
bsflow-2.3.0 lib/bsflow/pipeline.rb
bsflow-2.2.0 lib/bsflow/pipeline.rb