Project

General

Profile

Actions

Bug #10601

closed

Unexpected behaviour changes for Struct class

Added by hsbt (Hiroshi SHIBATA) over 9 years ago. Updated over 9 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.2.0dev (2014-12-14 trunk 48835) [x86_64-darwin13]
[ruby-core:66846]

Description

r48748 changes below code behaviour.

class Request < Struct.new(:params, :headers)
  def params=(hash)
    super
  end
 
  def []=(key, value)
    headers[key] = value
  end
end
 
Request.new.params = {}
% ruby -v test.rb
ruby 2.2.0dev (2014-12-14 trunk 48835) [x86_64-darwin13]
test.rb:7:in `[]=': undefined method `[]=' for nil:NilClass (NoMethodError)
	from <compiled>:1:in `params='
	from test.rb:3:in `params='
	from test.rb:11:in `<main>'
% ruby -v test.rb
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin13.0]

above code is included faraday known as famous http client library.

normal

Can you investigate or revert r48748?

I think this commit is feature category if it's your expected changes.
We shouldn't apply this in 2.2.0.rc phase.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0