Class: Datapipes::Source

Inherits:
Object
  • Object
show all
Includes:
Composable
Defined in:
lib/datapipes/source.rb

Overview

Build your own source logic in ‘run` method. Use `produce` method to emitt data to pipe.

def run
  10.times {|i| produce(i) }
end

Instance Attribute Summary collapse

Attributes included from Composable

#accumulated

Instance Method Summary collapse

Methods included from Composable

#+

Instance Attribute Details

#pipeObject

Returns the value of attribute pipe.



13
14
15
# File 'lib/datapipes/source.rb', line 13

def pipe
  @pipe
end

Instance Method Details

#run_allObject



15
16
17
18
# File 'lib/datapipes/source.rb', line 15

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