Project

General

Profile

Actions

Bug #21302

open

Remove or Fix Set#to_h

Added by jeremyevans0 (Jeremy Evans) 2 days ago. Updated 1 day ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:121804]

Description

When backwards-compatible marshalling support for Set was added in 926411171d296859839745a536aa86bc1e18aa76, Set#to_h was added. I'm not sure if intentionally or accidentally (@nobu (Nobuyoshi Nakada) knows). The method is not backwards compatible with the previous Set#to_h method (Enumerable#to_h), so it should be fixed or removed. Since it is a new method added to a core class, it should be officially approved if we want to keep it.

I would prefer removing it. Users that want a true-valued hash can use to_h { [it, true] } instead of to_h. I have submitted a pull request to remove it: https://github.com/ruby/ruby/pull/13247

However, if we want to keep it, we should fix it to be backwards compatible and add tests and documentation. I have submitted a pull request for that as well: https://github.com/ruby/ruby/pull/13248

Actions

Also available in: Atom PDF

Like0
Like0Like0