Skip to content

Instantly share code, notes, and snippets.

@amatsuda
Created September 1, 2019 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amatsuda/113c02a84748db31ee29ce6300f5e1e1 to your computer and use it in GitHub Desktop.
Save amatsuda/113c02a84748db31ee29ce6300f5e1e1 to your computer and use it in GitHub Desktop.
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)
$ 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