From 0e4fa0af3a8f6d84d35989f9a5c0fe9e4ef66332 Mon Sep 17 00:00:00 2001 From: Violet Graves Date: Wed, 9 Jul 2025 12:06:09 -0400 Subject: [PATCH 1/2] remove openstruct in favor of Data object warning: /.rbenv/versions/3.4.1/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. --- lib/luhn/civic_number.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/luhn/civic_number.rb b/lib/luhn/civic_number.rb index e9a08c1..bbabb19 100644 --- a/lib/luhn/civic_number.rb +++ b/lib/luhn/civic_number.rb @@ -1,5 +1,4 @@ # encoding: UTF-8 -require 'ostruct' module Luhn class CivicNumber attr_reader :value @@ -33,11 +32,11 @@ def male? end def birth_date - OpenStruct.new({ - :year => value[0...2].to_i, - :month => value[2...4].to_i, - :day => value[4...6].to_i - }) + Data.define(:year, :month, :day).new( + value[0...2].to_i, + value[2...4].to_i, + value[4...6].to_i + ) end def formatted From cfcb00c2cbede205d24ceacc7f570b3d61bda619 Mon Sep 17 00:00:00 2001 From: Violet Graves Date: Wed, 9 Jul 2025 12:24:11 -0400 Subject: [PATCH 2/2] require ruby 3.2+ for Data object access --- luhn.gemspec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/luhn.gemspec b/luhn.gemspec index 1b10181..61a5f52 100644 --- a/luhn.gemspec +++ b/luhn.gemspec @@ -12,5 +12,7 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.files = Dir.glob("{lib,spec}/**/*") + %w[LICENSE README.rdoc] + s.required_ruby_version = '>= 3.2' + s.add_development_dependency 'minitest', '~> 2.6.0' -end \ No newline at end of file +end