OpenStruct#method_missing handles #= wrongly
Code to reproduce:¶
require "ostruct" OpenStruct.new[:foo] = true
NoMethodError to be raised, as
OpenStruct#= is not a defined method.
wrong number of arguments (2 for 1) (ArgumentError)
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.
Updated by caius (Caius Durling) almost 12 years ago
On 20 Dec 2010, at 23:43, Caius Durling wrote:
Erm, not quite sure why reloading the redmine page triggered another notification about the ticket to be sent to the list. Apologies about that.
Updated by marcandre (Marc-Andre Lafortune) over 11 years ago
- Status changed from Open to Closed
- Target version set to 1.9.3
- % Done changed from 0 to 100
Thanks for the patch.
It was modified so that:
- s also raises an error
- s=2 states that "=" is the missing method (not "")
Applied as r31753, RubySpec updated as 9d36c78