Skip to content

Instantly share code, notes, and snippets.

@afa
Created August 10, 2012 12:16
Show Gist options
  • Save afa/3313839 to your computer and use it in GitHub Desktop.
Save afa/3313839 to your computer and use it in GitHub Desktop.
class Symbol
def | other
if other.is_a? Proc
-> arg { other.call(arg.send(self)) }
else
-> arg { arg.send(self).send(other) }
end
end
def call *args
-> arg { arg.send(self, *args) }
end
end
class Proc
def | other
if other.is_a? Proc
-> arg { other.call(call(arg)) }
else
-> arg { call(arg).send(other) }
end
end
def < arg
self.call arg
end
end
p :split | :take.(10) | :reverse < File.read($0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment