Class: Valvat::Checksum::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/valvat/checksum.rb

Direct Known Subclasses

AT, BE, BG, CY, DE, DK, EE, ES, FI, FR, GB, GR, HR, HU, IE, IT, LT, LU, MT, NL, PL, PT, RO, SE, SI

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(vat) ⇒ Base

Returns a new instance of Base.



13
14
15
# File 'lib/valvat/checksum.rb', line 13

def initialize(vat)
  @vat = vat
end

Instance Attribute Details

#vatObject (readonly)

Returns the value of attribute vat.



6
7
8
# File 'lib/valvat/checksum.rb', line 6

def vat
  @vat
end

Class Method Details

.check_digit_length(len = nil) ⇒ Object



8
9
10
11
# File 'lib/valvat/checksum.rb', line 8

def self.check_digit_length(len = nil)
  @check_digit_length = len if len
  @check_digit_length || 1
end

Instance Method Details

#validateObject



17
18
19
# File 'lib/valvat/checksum.rb', line 17

def validate
  check_digit == given_check_digit
end