Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class MyError < StandardError
def initialize(**options)
p options
end
end
raise MyError, foo: :bar
@r7kamura
Copy link
Author

r7kamura commented May 29, 2020

$ ruby /Users/r7kamura/Desktop/raise_kwargs_test.rb
/Users/r7kamura/Desktop/raise_kwargs_test.rb:7: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/Users/r7kamura/Desktop/raise_kwargs_test.rb:2: warning: The called method `initialize' is defined here
{:foo=>:bar}
Traceback (most recent call last):
/Users/r7kamura/Desktop/raise_kwargs_test.rb:7:in `<main>': MyError (MyError)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment