Class: BankTools::GB::SortCode
- Inherits:
-
Object
- Object
- BankTools::GB::SortCode
- Defined in:
- lib/banktools-gb/sort_code.rb
Constant Summary collapse
- LENGTH =
6
Instance Method Summary collapse
Instance Method Details
#compacted_value ⇒ Object
27 28 29 |
# File 'lib/banktools-gb/sort_code.rb', line 27 def compacted_value original_value.to_s.gsub(/[\s-]/, "") end |
#errors ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/banktools-gb/sort_code.rb', line 17 def errors errors = [] errors << Errors::SORT_CODE_TOO_SHORT if compacted_value.length < LENGTH errors << Errors::SORT_CODE_TOO_LONG if compacted_value.length > LENGTH errors << Errors::SORT_CODE_INVALID_CHARACTERS if any_non_digits? errors end |
#valid? ⇒ Boolean
13 14 15 |
# File 'lib/banktools-gb/sort_code.rb', line 13 def valid? errors.none? end |