Created
February 24, 2014 14:32
-
-
Save PragTob/9189371 to your computer and use it in GitHub Desktop.
Simple delegator + open = boom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'delegate' | |
class MyOpen | |
def open | |
puts 'my open' | |
end | |
end | |
my_open = MyOpen.new | |
wrapped = SimpleDelegator.new my_open | |
wrapped.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>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://ruby-doc.org/core-2.0/Kernel.html#method-i-open
I've never had good experiences shadowing methods from Kernel.