General

Profile

ybiquitous (Masafumi Koba)

  • Login: ybiquitous
  • Registered on: 05/31/2025
  • Last sign in: 06/02/2025

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 1 0 1

Activity

06/02/2025

10:17 AM Ruby Feature #21387: Proposal to add Data#[]
@zverok @eregon Thanks for the feedback.
Reconsidering my motivation, I may have expected `Data` to be something like an *immutable* `Struct` (or even an *immutable* `Hash`).
I'm still attracted to this idea of an immutable `Hash`-...
ybiquitous (Masafumi Koba)

05/31/2025

01:41 PM Ruby Feature #21387: Proposal to add Data#[]
@zverok Thank you for the feedback!
My example of `data_people.pluck(:name)` was not so good, sorry. A strength of `pluck` is to accept multiple keys like `data_people.pluck(:name, :age)`, so `.map` isn't a proper alternative in this ...
ybiquitous (Masafumi Koba)
06:10 AM Ruby Feature #21387 (Open): Proposal to add Data#[]
## Proposal
I propose to add a new instance method `#[]` to the `Data` class, similar to [`Struct#[]`](https://docs.ruby-lang.org/en/3.4/Struct.html#method-i-5B-5D).
If writing the method signature in RBS, it would be like this:
...
ybiquitous (Masafumi Koba)

Also available in: Atom