Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Simple delegator + open = boom
require 'delegate'
class MyOpen
def open
puts 'my open'
my_open =
wrapped = my_open #works
wrapped.send :open # boom on 2.0-p353.. works on 2.1 though
# tobi@speedy:~/Dropbox/Rubyhacking$ ruby open.rb
# my open
# open.rb:13:in `initialize': wrong number of arguments (0 for 1..3) (ArgumentError)
# from open.rb:13:in `open'
# from open.rb:13:in `<main>'
Copy link

rentalcustard commented Feb 24, 2014

I've never had good experiences shadowing methods from Kernel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment