Forum: Ruby-dev [ruby-trunk - Bug #7382][Open] Struct#each pairのyieldと他のeach pairのそれの相違

Posted by tadf (tadayoshi funaba) (Guest)
on 2012-11-18 09:12
(Received via mailing list)
Issue #7382 has been reported by tadf (tadayoshi funaba).

----------------------------------------
Bug #7382: Struct#each_pairのyieldと他のeach_pairのそれの相違
https://bugs.ruby-lang.org/issues/7382

Author: tadf (tadayoshi funaba)
Status: Open
Priority: Low
Assignee:
Category:
Target version:
ruby -v: ruby 2.0.0dev (2012-11-18 trunk 37708) [i686-linux]


Struct#each_pairが他のeach_pairと異なります。
他はENVなども含めてassocで、Structだけvaluesなので解りにくいです。


require 'ostruct'

h = {'a'=>1, 'b'=>2}
S = Struct.new('S', 'a', 'b')
s = S.new(1, 2)
o = OpenStruct.new(h)

h.each_pair{|x| p x}
s.each_pair{|x| p x}
o.each_pair{|x| p x}
Posted by matz (Yukihiro Matsumoto) (Guest)
on 2012-11-18 16:11
(Received via mailing list)
Issue #7382 has been updated by matz (Yukihiro Matsumoto).

Assignee set to nobu (Nobuyoshi Nakada)
Target version set to 2.0.0

おっしゃることはもっともなので、直してトラブルが起きないかどうか確認したいです。
中田さん、お願いしていい?

Matz.

----------------------------------------
Bug #7382: Struct#each_pairのyieldと他のeach_pairのそれの相違
https://bugs.ruby-lang.org/issues/7382#change-33057

Author: tadf (tadayoshi funaba)
Status: Open
Priority: Low
Assignee: nobu (Nobuyoshi Nakada)
Category:
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-18 trunk 37708) [i686-linux]


Struct#each_pairが他のeach_pairと異なります。
他はENVなども含めてassocで、Structだけvaluesなので解りにくいです。


require 'ostruct'

h = {'a'=>1, 'b'=>2}
S = Struct.new('S', 'a', 'b')
s = S.new(1, 2)
o = OpenStruct.new(h)

h.each_pair{|x| p x}
s.each_pair{|x| p x}
o.each_pair{|x| p x}
Posted by matz (Yukihiro Matsumoto) (Guest)
on 2012-11-18 16:11
(Received via mailing list)
Issue #7382 has been updated by matz (Yukihiro Matsumoto).

Status changed from Open to Assigned


----------------------------------------
Bug #7382: Struct#each_pairのyieldと他のeach_pairのそれの相違
https://bugs.ruby-lang.org/issues/7382#change-33058

Author: tadf (tadayoshi funaba)
Status: Assigned
Priority: Low
Assignee: nobu (Nobuyoshi Nakada)
Category:
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-18 trunk 37708) [i686-linux]


Struct#each_pairが他のeach_pairと異なります。
他はENVなども含めてassocで、Structだけvaluesなので解りにくいです。


require 'ostruct'

h = {'a'=>1, 'b'=>2}
S = Struct.new('S', 'a', 'b')
s = S.new(1, 2)
o = OpenStruct.new(h)

h.each_pair{|x| p x}
s.each_pair{|x| p x}
o.each_pair{|x| p x}
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.