Class: TinValid::ItalyTin
- Inherits:
-
Object
- Object
- TinValid::ItalyTin
- Includes:
- Helpers
- Defined in:
- lib/tin_valid/italy_tin.rb
Overview
rubocop:disable Metrics/ClassLength
Instance Attribute Summary collapse
-
#birth_date ⇒ Object
readonly
Returns the value of attribute birth_date.
-
#tin ⇒ Object
readonly
Returns the value of attribute tin.
Instance Method Summary collapse
-
#initialize(tin:, birth_date: nil) ⇒ ItalyTin
constructor
A new instance of ItalyTin.
- #valid? ⇒ Boolean
Constructor Details
#initialize(tin:, birth_date: nil) ⇒ ItalyTin
Returns a new instance of ItalyTin.
8 9 10 11 |
# File 'lib/tin_valid/italy_tin.rb', line 8 def initialize(tin:, birth_date: nil) @tin = tin @birth_date = birth_date end |
Instance Attribute Details
#birth_date ⇒ Object (readonly)
Returns the value of attribute birth_date.
13 14 15 |
# File 'lib/tin_valid/italy_tin.rb', line 13 def birth_date @birth_date end |
#tin ⇒ Object (readonly)
Returns the value of attribute tin.
13 14 15 |
# File 'lib/tin_valid/italy_tin.rb', line 13 def tin @tin end |
Instance Method Details
#valid? ⇒ Boolean
15 16 17 18 19 20 21 |
# File 'lib/tin_valid/italy_tin.rb', line 15 def valid? match = MATCHER.match(tin) return false unless match return false unless valid_date?(match) tin[-1] == check end |