Sha256: c9c1a3feb3425770f678e8feaa4defbbab13cbe4659d3499979dded6dd93a13f

Contents?: true

Size: 385 Bytes

Versions: 3

Compression:

Stored size: 385 Bytes

Contents

class Datapipes
  # Tube takes effect data which passes through pipe.
  #
  # Build your own tube logic in `run` method.
  class Tube
    def run_all(data)
      accumulated ||= [self]

      accumulated.reduce(data) do |d, tube|
        if tube.accept? d
          tube.run(d)
        else
          d
        end
      end
    end

    def accept?(data)
      true
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
datapipes-0.0.3 lib/datapipes/tube.rb
datapipes-0.0.2 lib/datapipes/tube.rb
datapipes-0.0.1 lib/datapipes/tube.rb