Created
February 25, 2021 09:15
-
-
Save kamipo/69b895af8d13d2e4445654378e51db70 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using Module.new { | |
refine Enumerable do | |
alias :orig_sum :sum | |
end | |
} | |
module Enumerable | |
def sum(...) | |
p method(:orig_sum) | |
end | |
end | |
class A | |
include Enumerable | |
end | |
class B | |
include Enumerable | |
def sum(...) | |
super | |
end | |
end | |
p RUBY_VERSION | |
A.new.sum | |
B.new.sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment