Skip to content

Instantly share code, notes, and snippets.

@reinh
Last active April 12, 2019 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reinh/bfcfb7ca6fe6b010599d1b7dd291137e to your computer and use it in GitHub Desktop.
Save reinh/bfcfb7ca6fe6b010599d1b7dd291137e to your computer and use it in GitHub Desktop.
class Proc
%i[! ~].each do |op|
define_method(op) { ->(x) { call(x).send(op)} }
end
%i[+ - * / ^ & |].each do |op|
define_method(op) { |other| ->(x) { call(x).send op, other.call(x) } }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment