Bug #4179
OpenStruct#method_missing handles #[]= wrongly
Description
=begin
## Code to reproduce:
require "ostruct" OpenStruct.new[:foo] = true
## Expected
NoMethodError
to be raised, as OpenStruct#[]=
is not a defined method.
## Actual
wrong number of arguments (2 for 1) (ArgumentError)
## Notes
I wrote a test case to check that it would raise NoMethodError
when you call OpenStruct#[]=
, and then amended OpenStruct#method_missing
to fix the bug. Patch attached with both test case (including a check that OpenStruct#[]
raises a NoMethodError
too) and the fix in it.
=end
Files