Skip to content

YAML::Store dependency for pstore is required and fails on Ruby 4.0 #69

Open

Description

@ekohl

YAML::Store has this require statement:

yaml/lib/yaml/store.rb

Lines 7 to 10 in 79b6b15

begin
require 'pstore'
rescue LoadError
end

But really it directly inherits from PStore:

class YAML::Store < PStore

Since Ruby 4.0 pstore is a bundled gem instead of a default gem: https://www.ruby-lang.org/en/news/2025/12/25/ruby-4-0-0-released/#stdlib-updates

The following bundled gems are promoted from default gems.
pstore 0.2.0
0.1.4 to v0.2.0

Though I think https://stdgems.org/pstore/ provides a clearer overview.

I'm not sure what is best: make yaml depend on pstore in the gemspec or simply make it a soft dependency. In either case, the LoadError shouldn't be silently supressed.

Activity

  1. boof commented on Jan 15, 2026

    @boof

    IMHO, this is a hard dependency and should be added to the gemspec. IDK the minimum version, though.

  2. boof commented on Jan 30, 2026

    @boof

    After thinking about it a little bit I also thought about extracting the store functionality would be the way to go.

    After giving it more thought, I think it is fine to leave it as it is for the major part.

    With Ruby 4 the warning disappears and an exception will be raised when the file is being loaded.
    The only thing I'd change is to emit instructions when catching the LoadError but still let it fail with the exception.

    Another option would be to include this into PStore instead of YAML. There, they can simply load Psych.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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