Class: RussianPost::Barcode::International

Inherits:
Base
  • Object
show all
Defined in:
lib/russianpost/barcode/international.rb

Constant Summary collapse

WEIGHT_FACTORS =
[8, 6, 4, 2, 3, 5, 9, 7, 0]

Instance Attribute Summary

Attributes inherited from Base

#barcode, #digits

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, #to_s

Constructor Details

This class inherits a constructor from RussianPost::Barcode::Base

Class Method Details

.formatObject



9
10
11
# File 'lib/russianpost/barcode/international.rb', line 9

def self.format
  /\A([A-Z]{2}\d{9}[A-Z]{2})\Z/
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/russianpost/barcode/international.rb', line 13

def valid?
  super && country_exists?
end