Skip to content

Conversation

gee-forr
Copy link

@gee-forr gee-forr commented Oct 3, 2025

Hi @joeljunstrom,

Thank you for this gem. It is a crucial component in a gem we maintain.

We've started seeing deprecation warnings upon upgrading some of our apps to Ruby 3.4.x, related to this gem:

/gems/ruby/3.4.0/gems/luhn-1.0.2/lib/luhn/civic_number.rb:2: warning: /usr/local/lib/ruby/3.4.0/ostruct.rb was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
You can add ostruct to your Gemfile or gemspec to silence this warning.
Also please contact the author of luhn-1.0.2 to request adding ostruct into its gemspec.

There's already a great open PR #4 that addresses this by swapping out ostruct for the newish Data class, but that forces the gem's minimum Ruby version to 3.2+.

This PR takes a different approach and conditionally adds the ostruct gem as a dependency if the Ruby version is 3.4.0 or greater, without requiring a change in Ruby version.

I also updated the README to markdown to improve its rendering (hope you don't mind).

Thanks again for this useful gem :)

@joeljunstrom
Copy link
Owner

Sounds reasonable! I can put out a patch for this and then a major for the data.define.

But I'd also say since I haven't looked at this repo in 10 years (yikes) that if you are only using the method to check if a number is valid Luhn it would probably be prudent to skip this dependency and just add the method to your project (the algorithm won't change).

@joeljunstrom joeljunstrom merged commit b4c5435 into joeljunstrom:master Oct 3, 2025
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.

2 participants