Sha256: b1f75bd899987361d07c31001602c6d0da874ac7b6e71cfad63db22e2d99fd1f

Contents?: true

Size: 486 Bytes

Versions: 1

Compression:

Stored size: 486 Bytes

Contents

module BSFlow
  class Combine
    def initialize(*args, combine_proc: nil, sub_procs: [])
      if combine_proc
        @sub_procs = sub_procs
        @combine_proc = combine_proc
      else
        @sub_procs = args[0..-2]
        @combine_proc = args.last
      end
    end
    
    def call(*args)
      sub_proc_outputs = []
      @sub_procs.each do |sub_proc|
        sub_proc_outputs << sub_proc.call(*args)
      end
      @combine_proc.call(*sub_proc_outputs)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bsflow-2.6.0 lib/bsflow/combine.rb