class BaseException

Attributes

account_number[R]
check_number[R]
modulus_weight[R]
sort_code[R]

Public Class Methods

allow_any?() click to toggle source
# File lib/uk_account_validator/exceptions/base_exception.rb, line 13
def self.allow_any?
  false
end
new(modulus_weight, account_number, sort_code, check_number) click to toggle source
# File lib/uk_account_validator/exceptions/base_exception.rb, line 6
def initialize(modulus_weight, account_number, sort_code, check_number)
  @modulus_weight = modulus_weight
  @account_number = account_number
  @sort_code      = sort_code
  @check_number   = check_number
end

Public Instance Methods

after_calculate_total(total, _test_digits) click to toggle source

Returns the new total after any adjustments

# File lib/uk_account_validator/exceptions/base_exception.rb, line 27
def after_calculate_total(total, _test_digits)
  return total
end
apply_account_number_substitutions() click to toggle source
# File lib/uk_account_validator/exceptions/base_exception.rb, line 31
def apply_account_number_substitutions
  return account_number
end
apply_sort_code_substitutions() click to toggle source

Returns the new sort code after substitutions

# File lib/uk_account_validator/exceptions/base_exception.rb, line 36
def apply_sort_code_substitutions
  return sort_code
end
override_test?() click to toggle source
# File lib/uk_account_validator/exceptions/base_exception.rb, line 17
def override_test?
  false
end
replace_weight(_test_digits) click to toggle source

Returns the new modulus weight after applying the exception.

# File lib/uk_account_validator/exceptions/base_exception.rb, line 22
def replace_weight(_test_digits)
  return modulus_weight
end
zero_all() click to toggle source

Zero all weights

# File lib/uk_account_validator/exceptions/base_exception.rb, line 43
def zero_all
  UkAccountValidator::ModulusWeight.new(
    modulus_weight.sort_code_start,
    modulus_weight.sort_code_end,
    modulus_weight.modulus,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    modulus_weight.exception
  )
end
zero_u_b() click to toggle source

Zero weights for u to b

# File lib/uk_account_validator/exceptions/base_exception.rb, line 54
def zero_u_b
  UkAccountValidator::ModulusWeight.new(
    modulus_weight.sort_code_start,
    modulus_weight.sort_code_end,
    modulus_weight.modulus,
    0, 0, 0, 0, 0, 0, 0, 0,
    modulus_weight.c, modulus_weight.d, modulus_weight.e,
    modulus_weight.f, modulus_weight.g, modulus_weight.h,
    modulus_weight.exception
  )
end