This gem is being re-purposed by another Rubyist, and this repository is kept for historical reasons. If you want this functionality you can find it with the then
method:
1.then { "I can pipe with #{_1}!" }
# => "I can pipe with 1!
A play at Unix Piping in Ruby for kicks. It helps to break up some more exotic logic and chaining.
It can be used to play with a value in a method chain and return whatever you want out of the block. Personally I'm still toying with how it can be used and working to find clever tricks with it.
That being said, this is a 5 minute hack. You've been warned.
Piping is simple, we take the object and put a pipe on it:
1.pipe { |x| "#{x} is great!" }
# => '1 is great!'
How do you get going with pipe?
include Pipeable
...and your object is ready to go!
Add this line to your application's Gemfile:
gem 'pipeable'
And then execute:
$ bundle
Or install it yourself as:
$ gem install pipeable
Slap a pipe on the end of it!
- Fork it ( http://github.com/baweaver/pipeable/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 new Pull Request