Class: TinValid::NetherlandsTin
- Inherits:
-
Object
- Object
- TinValid::NetherlandsTin
- Defined in:
- lib/tin_valid/netherlands_tin.rb
Instance Attribute Summary collapse
-
#tin ⇒ Object
readonly
Returns the value of attribute tin.
Instance Method Summary collapse
-
#initialize(tin:) ⇒ NetherlandsTin
constructor
A new instance of NetherlandsTin.
- #valid? ⇒ Boolean
Constructor Details
#initialize(tin:) ⇒ NetherlandsTin
Returns a new instance of NetherlandsTin.
5 6 7 |
# File 'lib/tin_valid/netherlands_tin.rb', line 5 def initialize(tin:) @tin = tin end |
Instance Attribute Details
#tin ⇒ Object (readonly)
Returns the value of attribute tin.
9 10 11 |
# File 'lib/tin_valid/netherlands_tin.rb', line 9 def tin @tin end |
Instance Method Details
#valid? ⇒ Boolean
11 12 13 14 15 16 |
# File 'lib/tin_valid/netherlands_tin.rb', line 11 def valid? return false unless /\A[0-9]{9}\z/.match?(tin) return false if tin == "000000000" tin[-1].to_i == check end |