Skip to content

Instantly share code, notes, and snippets.

@judofyr
Forked from andkerosine/fun.rb
Created August 1, 2012 14:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save judofyr/3227310 to your computer and use it in GitHub Desktop.
Save judofyr/3227310 to your computer and use it in GitHub Desktop.
class Symbol
def | other
-> arg { other.to_proc[arg.send(self)] }
end
def call(*args)
-> arg { arg.send(self, *args) }
end
end
class Proc
def | other
-> arg { other.to_proc[call(arg)] }
end
alias < call
end
p :split.("->") | :flatten | :size | :chr < File.read($0)
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