Class: ElfproefPlan::ElfProef

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nr) ⇒ ElfProef



20
21
22
23
# File 'lib/elfproef_plan.rb', line 20

def initialize(nr)
  @nr = nr.to_s.scan(/[\d+$]/).map{|x| x.to_i}
  @nrs = (2..9).to_a.reverse
end

Instance Attribute Details

#nrObject

Returns the value of attribute nr.



18
19
20
# File 'lib/elfproef_plan.rb', line 18

def nr
  @nr
end

#nrsObject

Returns the value of attribute nrs.



18
19
20
# File 'lib/elfproef_plan.rb', line 18

def nrs
  @nrs
end

Instance Method Details

#validBsnObject



31
32
33
34
35
36
# File 'lib/elfproef_plan.rb', line 31

def validBsn
  return false if @nr.length > 9
  @nr.unshift 0 while @nr.length < 9
  return false if @nr[0,3].sum < 1
  elfproef(-1)
end

#validRekeningObject



25
26
27
28
29
# File 'lib/elfproef_plan.rb', line 25

def validRekening
  return false unless [9, 10].include? @nr.length
  nrs.unshift 10 if @nr.length == 10
  elfproef(1)
end