Class: Exception4

Inherits:
BaseException show all
Defined in:
lib/uk_account_validator/exceptions/exception_4.rb

Overview

Perform the standard modulus 11 check. After you have finished the check, ensure that the remainder is the same as the two-digit checkdigit; the checkdigit for exception 4 is gh from the original account number.

Constant Summary

Constants included from NumberIndices

NumberIndices::NUMBER_INDEX

Instance Attribute Summary

Attributes inherited from BaseException

#account_number, #check_number, #modulus_weight, #sort_code

Instance Method Summary collapse

Methods inherited from BaseException

#after_calculate_total, allow_any?, #apply_account_number_substitutions, #apply_sort_code_substitutions, #initialize, #replace_weight, #zero_all, #zero_u_b

Constructor Details

This class inherits a constructor from BaseException

Instance Method Details

#override_test?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/uk_account_validator/exceptions/exception_4.rb', line 6

def override_test?
  true
end

#test(modulus, total, test_digits, _test) ⇒ Object



10
11
12
13
14
15
# File 'lib/uk_account_validator/exceptions/exception_4.rb', line 10

def test(modulus, total, test_digits, _test)
  check_sum = [test_digits[NUMBER_INDEX[:g]], test_digits[NUMBER_INDEX[:h]]].join
  check_sum = check_sum.to_i

  total % modulus == check_sum
end