Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
pipable
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
You can’t perform that action at this time.