Created
June 17, 2013 12:59
-
-
Save tatat/5796683 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
module M1 | |
def nyan1 | |
run_callback(->(*args){ args.join }, '1', '2', '3') | |
end | |
private | |
def run_callback(callback, *args) | |
callback.(*args) | |
end | |
end | |
module M2 | |
def nyan2 | |
run_callback | |
end | |
private | |
def run_callback | |
end | |
end | |
class A | |
include M1 | |
include M2 | |
end | |
p A.new.nyan2 #=> nil | |
p A.new.nyan1 #=> `run_callback': wrong number of arguments (4 for 0) (ArgumentError) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment