class UkAccountValidator::ModulusWeight

Constants

COLUMN_SIZES

the size of each column

Attributes

a[R]
b[R]
c[R]
d[R]
e[R]
exception[R]
f[R]
g[R]
h[R]
modulus[R]
sort_code_end[R]
sort_code_start[R]
u[R]
v[R]
w[R]
x[R]
y[R]
z[R]

Public Class Methods

from_line(definition_line) click to toggle source

@param definition_line The line from valacdos.txt that defines this weight.

# File lib/uk_account_validator/modulus_weight.rb, line 10
def self.from_line(definition_line)
  # See https://www.ruby-forum.com/topic/184294#805359
  data = definition_line.unpack("A#{COLUMN_SIZES.join('A')}")

  data.map!(&:strip)

  @sort_code_start, @sort_code_end, @modulus, @u, @v, @w, @x,
    @y, @z, @a, @b, @c, @d, @e, @f, @g, @h, @exception = data

  ModulusWeight.new(*data)
end
new(sort_code_start, sort_code_end, modulus, u, v, w, x, y, z, a, b, c, d, e, f, g, h, exception) click to toggle source
# File lib/uk_account_validator/modulus_weight.rb, line 22
def initialize(sort_code_start, sort_code_end, modulus, u, v, w, x, y, z,
      a, b, c, d, e, f, g, h, exception)

  @sort_code_start = sort_code_start
  @sort_code_end   = sort_code_end
  @modulus         = modulus
  @exception       = exception

  @u, @v, @w, @x, @y, @z, @a, @b, @c, @d, @e, @f, @g, @h =
    [u.to_i, v.to_i, w.to_i, x.to_i, y.to_i, z.to_i, a.to_i, b.to_i, c.to_i,
     d.to_i, e.to_i, f.to_i, g.to_i, h.to_i]
end