Class: BaseException
- Inherits:
-
Object
- Object
- BaseException
- Includes:
- NumberIndices
- Defined in:
- lib/uk_account_validator/exceptions/base_exception.rb
Direct Known Subclasses
Exception1, Exception10, Exception12, Exception14, Exception29, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8
Constant Summary
Constants included from NumberIndices
Instance Attribute Summary collapse
-
#account_number ⇒ Object
readonly
Returns the value of attribute account_number.
-
#check_number ⇒ Object
readonly
Returns the value of attribute check_number.
-
#modulus_weight ⇒ Object
readonly
Returns the value of attribute modulus_weight.
-
#sort_code ⇒ Object
readonly
Returns the value of attribute sort_code.
Class Method Summary collapse
Instance Method Summary collapse
-
#after_calculate_total(total, _test_digits) ⇒ Object
Returns the new total after any adjustments.
- #apply_account_number_substitutions ⇒ Object
-
#apply_sort_code_substitutions ⇒ Object
Returns the new sort code after substitutions.
-
#initialize(modulus_weight, account_number, sort_code, check_number) ⇒ BaseException
constructor
A new instance of BaseException.
- #override_test? ⇒ Boolean
-
#replace_weight(_test_digits) ⇒ Object
Returns the new modulus weight after applying the exception.
-
#zero_all ⇒ Object
Zero all weights.
-
#zero_u_b ⇒ Object
Zero weights for u to b.
Constructor Details
#initialize(modulus_weight, account_number, sort_code, check_number) ⇒ BaseException
Returns a new instance of BaseException.
6 7 8 9 10 11 |
# 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 |
Instance Attribute Details
#account_number ⇒ Object (readonly)
Returns the value of attribute account_number.
4 5 6 |
# File 'lib/uk_account_validator/exceptions/base_exception.rb', line 4 def account_number @account_number end |
#check_number ⇒ Object (readonly)
Returns the value of attribute check_number.
4 5 6 |
# File 'lib/uk_account_validator/exceptions/base_exception.rb', line 4 def check_number @check_number end |
#modulus_weight ⇒ Object (readonly)
Returns the value of attribute modulus_weight.
4 5 6 |
# File 'lib/uk_account_validator/exceptions/base_exception.rb', line 4 def modulus_weight @modulus_weight end |
#sort_code ⇒ Object (readonly)
Returns the value of attribute sort_code.
4 5 6 |
# File 'lib/uk_account_validator/exceptions/base_exception.rb', line 4 def sort_code @sort_code end |
Class Method Details
.allow_any? ⇒ Boolean
13 14 15 |
# File 'lib/uk_account_validator/exceptions/base_exception.rb', line 13 def self.allow_any? false end |
Instance Method Details
#after_calculate_total(total, _test_digits) ⇒ Object
Returns the new total after any adjustments
27 28 29 |
# 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 ⇒ Object
31 32 33 |
# File 'lib/uk_account_validator/exceptions/base_exception.rb', line 31 def apply_account_number_substitutions return account_number end |
#apply_sort_code_substitutions ⇒ Object
Returns the new sort code after substitutions
36 37 38 |
# File 'lib/uk_account_validator/exceptions/base_exception.rb', line 36 def apply_sort_code_substitutions return sort_code end |
#override_test? ⇒ Boolean
17 18 19 |
# File 'lib/uk_account_validator/exceptions/base_exception.rb', line 17 def override_test? false end |
#replace_weight(_test_digits) ⇒ Object
Returns the new modulus weight after applying the exception.
22 23 24 |
# File 'lib/uk_account_validator/exceptions/base_exception.rb', line 22 def replace_weight(_test_digits) return modulus_weight end |
#zero_all ⇒ Object
Zero all weights
43 44 45 46 47 48 49 50 51 |
# 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 ⇒ Object
Zero weights for u to b
54 55 56 57 58 59 60 61 62 63 64 |
# 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 |