Sha256: 4c85a3901ac4af27ad9f04207f92344c9d5b5a02fe8ce893af0b69d913077e97

Contents?: true

Size: 430 Bytes

Versions: 3

Compression:

Stored size: 430 Bytes

Contents

class Datapipes
  #
  # Build your own source logic in `run` method.
  # Use `produce` method to emitt data to pipe.
  #
  #   def run
  #     10.times {|i| produce(i) }
  #   end
  #
  class Source
    include Composable

    attr_accessor :pipe

    def run_all
      accumulated ||= [self]
      accumulated.map {|s| Thread.new { s.run } }
    end

    private

    def produce(data)
      pipe.recieve(data)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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