CrunchPipe is a library for writing modular, computation-focused, optionally-concurrent/parallel programs using the processing pipeline pattern. Borrowing concepts pioneered in the often-neglected fields of dataflow programming and process networks wherein computation can be modeled as a directed graph. CrunchPipe provides support for writing programs in this style using componenets such as streams and pipelines to encapsulate computational steps in a modular fashion.
Some mix of the following
Based loosely on 1966 research into the dataflow programming paradigm.
If you can draw your process as a directed graph, you can model your computation!
pipeline = CrunchPipe::Pipeline.new(:parallel => true)
pipeline.bind {|x| x + 1 }
pipeline.bind {|x| x / 2 }
pipeline.bind {|x| x * x }
Complete example:
provider = CrunchPipe::DataProvider.new
input_stream = CrunchPipe::Stream.new
pipeline = CrunchPipe::Pipeline.new(:parallel => true)
pipeline.bind do |element|
puts "--- Processing #{element}..."
element + 1
end
output_stream = CrunchPipe::Stream.new
end_point = CrunchPipe::DataEndPoint.new do |data|
puts "+++ End point got #{data}"
end
provider | input_stream
pipeline < input_stream
pipeline | output_stream
output_stream > end_point
provider.provide([1,2,3,4,5])
Streams are observable by anything
In no particular order
gem install crunchpipe --preContribute at the CrunchPipe GitHub page (it needs work)