class Exception10

For the exception 10 check, if ab = 09 or ab = 99 and g = 9, zeroise weighting positions u-b.

Public Class Methods

allow_any?() click to toggle source
# File lib/uk_account_validator/exceptions/exception_10.rb, line 4
def self.allow_any?
  true
end

Public Instance Methods

replace_weight(test_digits) click to toggle source
# File lib/uk_account_validator/exceptions/exception_10.rb, line 8
def replace_weight(test_digits)
  # if ab = 09 or 99 and g=9, zeroise weighting positions u-b.
  a = test_digits[NUMBER_INDEX[:a]]
  b = test_digits[NUMBER_INDEX[:b]]

  return zero_u_b if (a == 0 && b == 9) ||
    (a == 9 && b == 9 && test_digits[NUMBER_INDEX[:g]] == 9)

  return modulus_weight
end