Class: Brid::PIS
Instance Attribute Summary
Attributes inherited from GenericID
#number
Instance Method Summary
collapse
Methods inherited from GenericID
#check_digits_length, #freeze, #initialize, #invalid_sequential?, #valid?
Constructor Details
This class inherits a constructor from GenericID
Instance Method Details
#check_digits ⇒ Object
5
6
7
8
9
|
# File 'lib/brid/ids/pis.rb', line 5
def check_digits
@check_digits ||= begin
@number[/.$/]
end
end
|
#number_length ⇒ Object
3
|
# File 'lib/brid/ids/pis.rb', line 3
def number_length; 11; end
|
#sequential ⇒ Object
11
12
13
14
15
|
# File 'lib/brid/ids/pis.rb', line 11
def sequential
@sequential ||= begin
@number[/^(.*).$/, 1]
end
end
|
#to_s ⇒ Object
17
18
19
20
|
# File 'lib/brid/ids/pis.rb', line 17
def to_s
er = /^(.{3})(.{5})(.{2})(.{1})/
"#{@number.gsub(er, '\1.\2.\3-\4')}"
end
|