Skip to content

Conversation

@dentarg
Copy link
Member

@dentarg dentarg commented Feb 13, 2025

...as it no longer will ship with Ruby 3.5

From ddollar#807

This change introduces a local Struct, used in a supporting-deprecated use-case part of the code.

Benefit: When requiring ostruct, a warning is emitted by Ruby, saying that ostruct will no longer be a standard built-in library in Ruby 3.5.0.

This PR avoids the warning by using a Struct.

Credits to @olleolleolle

dentarg and others added 3 commits February 13, 2025 18:08
This does not work:

    $ ruby -e 'Struct.new(:foo => "bar")'
    -e:1:in 'Struct.new': unknown keyword: :foo (ArgumentError)
            from -e:1:in '<main>'

This reverts commit 1b5f994.
The OpenStruct library was not used in that test.

ostruct raises a warning about not being a shipped-and-bundled-with-Ruby standard library in Ruby 3.5.0.
...in order to avoid Ruby warnings in Ruby 3.5.0 about ostruct not being a built-in library.
@dentarg
Copy link
Member Author

dentarg commented Feb 13, 2025

I hope you don't mind @olleolleolle

dentarg referenced this pull request Feb 13, 2025
> warning: ostruct was loaded from the standard library, but will no
> longer be part of the default gems starting from Ruby 3.5.0.
@dentarg dentarg merged commit 96002f8 into main Feb 13, 2025
22 checks passed
@dentarg dentarg deleted the proper-ostruct-fix branch February 13, 2025 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants