Skip to content

Commit 0e4fa0a

Browse files
committed
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.
1 parent 6d80d20 commit 0e4fa0a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/luhn/civic_number.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# encoding: UTF-8
2-
require 'ostruct'
32
module Luhn
43
class CivicNumber
54
attr_reader :value
@@ -33,11 +32,11 @@ def male?
3332
end
3433

3534
def birth_date
36-
OpenStruct.new({
37-
:year => value[0...2].to_i,
38-
:month => value[2...4].to_i,
39-
:day => value[4...6].to_i
40-
})
35+
Data.define(:year, :month, :day).new(
36+
value[0...2].to_i,
37+
value[2...4].to_i,
38+
value[4...6].to_i
39+
)
4140
end
4241

4342
def formatted

0 commit comments

Comments
 (0)