Issue #15409 has been updated by marcandre (Marc-Andre Lafortune).


Hanmac (Hans Mackowiak) wrote in #note-11:
> i have seen ruby making problems when using `method_missing` without `res=
pond_to_missing`  so it might cause problems there

The PR doesn't change `respond_to?`. The `respond_to_missing` was added onl=
y for lazy initialization, which I'm removing. Otherwise it has always been=
 standard behavior that:

```
os =3D OpenStruct.new
os.respond_to?(:foo) # =3D> false
os.foo # =3D> nil
```

That's in part because responding to `:to_ary`, `:to_str`, etc., could be p=
roblematic.


----------------------------------------
Bug #15409: OpenStruct error when attribute is called 'method'
https://bugs.ruby-lang.org/issues/15409#change-87514

* Author: elioncho (El=EDas Orozco)
* Status: Assigned
* Priority: Normal
* Assignee: marcandre (Marc-Andre Lafortune)
* ruby -v: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin16]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
The following error is shown when you try to access an OpenStruct with a pr=
operty called method:

`method': wrong number of arguments (given 0, expected 1) (ArgumentError)

To replicate:

~~~ ruby
require 'ostruct'
o =3D OpenStruct.new({ method: 'get' })
o.method
~~~


The expected behavior should be to return 'get'




-- =

https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>