Project

General

Profile

Bug #14619

Updated by nobu (Nobuyoshi Nakada) over 1 year ago

~~~ ruby
class VariantHash < Hash
def respond_to_missing?(method_name, *args)
true
end

def method_missing(method_name, *args, &blk)
42
end
end

m = "foo_"
h = VariantHash.new(m => 'a')
puts h.method(m)
puts h.send(m)
~~~

Ruby 2.2.2

```
t.rb:14:in `method': undefined method `foo_' for class `VariantHash' (NameError)
from t.rb:14:in `<main>'
```


All other versions of Ruby, including 2.4.1

```
#<Method: VariantHash#foo_>
42
```


I couldn't find a dup for this, trying to track down whether this was a known bug. Thank you and sorry if this is a dup. I'm coming from https://github.com/intridea/hashie/pull/443

Back