Skip to content

Base initialization mutates caller options and rejects frozen hashes #206

Description

@OskarEichler

Current behavior

ProgressBar::Base#initialize inserts :projector into the caller-owned options Hash. A mutable input is unexpectedly changed; an equivalent frozen Hash raises FrozenError.

Reproduction

require "ruby-progressbar"
require "ruby-progressbar/outputs/null"
options = { output: ProgressBar::Outputs::Null, autostart: false }
ProgressBar::Base.new(options)
p options # now contains :projector
ProgressBar::Base.new(options.freeze) # FrozenError

Expected behavior

Construction reads caller options without changing their top-level contents and accepts a frozen options Hash.

Environment and verification

Reproduced on ruby-progressbar 1.13.0/current master with Ruby 4.0.6 and 3.2.11. Duplicating the top-level Hash before normalization passes the focused ownership model and the complete 244-example suite on both Rubies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions