Created
September 1, 2019 15:42
-
-
Save amatsuda/113c02a84748db31ee29ce6300f5e1e1 to your computer and use it in GitHub Desktop.
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
class A | |
def f(x: nil) | |
p x | |
end | |
end | |
class Wrapper | |
def initialize | |
@a = A.new | |
end | |
def method_missing(meth, *args) | |
@a.send(meth, *args) | |
end | |
end | |
Wrapper.new.f(x: 1) |
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
$ ruby kwargs_method_missing.rb | |
kwargs_method_missing.rb:13: warning: The last argument is used as the keyword parameter | |
kwargs_method_missing.rb:2: warning: for `f' defined here | |
1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment