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 diff --git a/luhn.gemspec b/luhn.gemspec index 5cab56b..61a5f52 100644 --- a/luhn.gemspec +++ b/luhn.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.files = Dir.glob("{lib,spec}/**/*") + %w[LICENSE README.rdoc] - s.add_dependency 'ostruct', '~> 0' if Gem.ruby_version >= Gem::Version.new("3.4.0") + s.required_ruby_version = '>= 3.2' s.add_development_dependency 'minitest', '~> 2.6.0' end