Created
February 19, 2015 15:28
-
-
Save JEG2/9b2bd99a31bcbcbf273a to your computer and use it in GitHub Desktop.
Is this a bug in Ruby or just a poor method definition on my part?
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 HashLike | |
def to_hash | |
{a: 1, b: 2} | |
end | |
end | |
def surprise(*args, keyword: nil) | |
p args | |
end | |
surprise(HashLike.new) | |
# ~> -:11:in `<main>': unknown keywords: a, b (ArgumentError) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm even surprised at a simpler case; the fact that it calls
to_hash
at all.