Class: Exception6

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

Overview

Indicates that these sorting codes may contain foreign currency accounts which cannot be checked. Perform the first and second checks, except:

If a = 4, 5, 6, 7 or 8, and g and h are the same, the accounts are for a
foreign currency and the checks cannot be used.

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, #override_test?, #zero_all, #zero_u_b

Constructor Details

This class inherits a constructor from BaseException

Instance Method Details

#replace_weight(test_digits) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/uk_account_validator/exceptions/exception_6.rb', line 7

def replace_weight(test_digits)
  a = test_digits[NUMBER_INDEX[:a]]
  g = test_digits[NUMBER_INDEX[:g]]
  h = test_digits[NUMBER_INDEX[:h]]

  return zero_all if (a == 4 || a == 5 || a == 6 || a == 7 || a == 8) && g == h

  return modulus_weight
end