Class: UkAccountValidator::Validators::BaseValidator
- Inherits:
-
Object
- Object
- UkAccountValidator::Validators::BaseValidator
- Includes:
- NumberIndices
- Defined in:
- lib/uk_account_validator/validators/base_validator.rb
Direct Known Subclasses
Constant Summary
Constants included from NumberIndices
Instance Attribute Summary collapse
-
#account_number ⇒ Object
readonly
Returns the value of attribute account_number.
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#modulus_weight ⇒ Object
readonly
Returns the value of attribute modulus_weight.
-
#sort_code ⇒ Object
readonly
Returns the value of attribute sort_code.
Instance Method Summary collapse
- #applying_exceptions(test_digits) ⇒ Object
-
#initialize(account_number, sort_code, modulus_weight, exception) ⇒ BaseValidator
constructor
A new instance of BaseValidator.
Constructor Details
#initialize(account_number, sort_code, modulus_weight, exception) ⇒ BaseValidator
Returns a new instance of BaseValidator.
8 9 10 11 12 13 14 15 |
# File 'lib/uk_account_validator/validators/base_validator.rb', line 8 def initialize(account_number, sort_code, modulus_weight, exception) @account_number = account_number @sort_code = sort_code @modulus_weight = modulus_weight @exception = exception @sort_code = exception.apply_sort_code_substitutions end |
Instance Attribute Details
#account_number ⇒ Object (readonly)
Returns the value of attribute account_number.
6 7 8 |
# File 'lib/uk_account_validator/validators/base_validator.rb', line 6 def account_number @account_number end |
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
6 7 8 |
# File 'lib/uk_account_validator/validators/base_validator.rb', line 6 def exception @exception end |
#modulus_weight ⇒ Object (readonly)
Returns the value of attribute modulus_weight.
6 7 8 |
# File 'lib/uk_account_validator/validators/base_validator.rb', line 6 def modulus_weight @modulus_weight end |
#sort_code ⇒ Object (readonly)
Returns the value of attribute sort_code.
6 7 8 |
# File 'lib/uk_account_validator/validators/base_validator.rb', line 6 def sort_code @sort_code end |
Instance Method Details
#applying_exceptions(test_digits) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/uk_account_validator/validators/base_validator.rb', line 17 def (test_digits) @modulus_weight = exception.replace_weight(test_digits) total = yield total = exception.after_calculate_total(total, test_digits) total end |