diff options
author | Yusuke Endoh <[email protected]> | 2023-01-24 17:40:57 +0900 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2023-02-20 10:33:06 +0900 |
commit | 1fd181b453a6a2dd16897473afa2f402c7dba8aa (patch) | |
tree | 434aa52c074a3729e85a225b4210da163d39549a /test/ruby/test_module.rb | |
parent | e7b8d32e166815f2e7edebf32aa178915d191b8c (diff) |
error.c: Update the message format for NoMethodError
* If the receiver is a Class, use "... for class <class name>".
* If the receiver is a Module, use "... for module <module name>".
* If the receiver is an extended object (i.e., has a singleton class),
use "... for <rb_any_to_s(receiver)>".
* Otherwise, use "... for an instance of <class name>".
Examples:
```
42.time #=> undefined method `time' for an instance of Integer (NoMethodError)
class Foo
privatee #=> undefined local variable or method 'privatee' for class Foo (NoMethodError)
end
def (o=Object.new).foo
end
o.bar #=> undefined method `bar' for #<Object: 0xdeadbeef(any_to_s)> (NoMethodError)
```
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6950
Diffstat (limited to 'test/ruby/test_module.rb')
0 files changed, 0 insertions, 0 deletions