Skip to content

The additional methods for Random::Formatter should be part of the standard library. #2660

@ksss

Description

@ksss

Several methods defined in core/rbs/unnamed/random.rbs are methods made available in Ruby through the extension library random.formatter.

$ ruby -e 'p Random.uuid'
-e:1:in '<main>': undefined method 'uuid' for class Random (NoMethodError)

$ ruby -r random/formatter -e 'p Random.uuid'
"21f9f77d-a378-4f6f-8ec6-f90dd17cb5ff"

We should define stdlib random/formatter and move the methods from core.
Moving from core to stdlib is an incompatible change.
We've had the same experience with stringio, so it should be a useful reference.

The random/formatter is an extension almost exclusively for securerandom, so the impact should be minimal.
Simply moving the method is also an option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions