cr-pipeline
A basic pipeline implementation in Crystal.
Installation
Add this to your application's shard.yml
:
dependencies:
cr-pipeline:
github: bluematt/cr-pipeline
Usage
require "cr-pipeline"
class Doubler
include PipelineAction
def invoke(payload)
payload * 2
end
end
class Duplicator
include PipelineAction
def invoke(payload)
"#{payload},#{payload}"
end
end
p_prime = Pipeline.new << Doubler.new
p = Pipeline.new << Doubler.new << p_prime << Duplicator.new << Duplicator.new
puts p.process(2) #=> "8,8,8,8"
Development
$ crystal spec
Contributing
- Fork it ( https://github.com/bluematt/cr-pipeline/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- bluematt bluematt - creator, maintainer