Created
September 26, 2014 13:31
-
-
Save petrachi/637f9367404708ec341a to your computer and use it in GitHub Desktop.
pipable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A = ->(s){ s << "a" } | |
B = ->(s){ s << "b" } | |
C = ->(s){ s << "c" } | |
str = "" | |
class Object | |
PIPED = ->(*args, arg){ arg.is_a?(Proc) ? arg[PIPED[*args]] : arg } | |
def | *args | |
PIPED.curry[self, *args] | |
end | |
end | |
puts str | A | B | C |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment