Skip to content

baweaver/pipeable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

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!

Pipeable

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!

Installation

Add this line to your application's Gemfile:

gem 'pipeable'

And then execute:

$ bundle

Or install it yourself as:

$ gem install pipeable

Usage

Slap a pipe on the end of it!

Contributing

  1. Fork it ( http://github.com/baweaver/pipeable/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

A play at unix piping

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages