Actions
Bug #7382
closedStruct#each_pairのyieldと他のeach_pairのそれの相違
Description
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}
Updated by matz (Yukihiro Matsumoto) about 12 years ago
- Assignee set to nobu (Nobuyoshi Nakada)
- Target version set to 2.0.0
おっしゃることはもっともなので、直してトラブルが起きないかどうか確認したいです。
中田さん、お願いしていい?
Matz.
Updated by matz (Yukihiro Matsumoto) about 12 years ago
- Status changed from Open to Assigned
Updated by nobu (Nobuyoshi Nakada) almost 12 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r37721.
tadayoshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
struct.c: yield assoc in each_pair
- struct.c (rb_struct_each_pair): yield associated pairs so that
an unsplat argument can get both, for consistency with Hash,
OpenStruct, and etc. [ruby-dev:46533] [Bug #7382]
Actions
Like0
Like0Like0Like0