Class: BankAccountTools::BBAN
- Inherits:
-
Object
- Object
- BankAccountTools::BBAN
- Defined in:
- lib/bank_account_tools/bban.rb
Overview
Basic Bank Account Number
Instance Method Summary collapse
- #country_applies_iban? ⇒ Boolean
-
#initialize(country_code, code) ⇒ BBAN
constructor
A new instance of BBAN.
- #to_s ⇒ Object
- #valid? ⇒ Boolean
-
#valid_length? ⇒ Boolean
the bban is the iban minus the first 4 characters (country_code, check_digits).
Constructor Details
#initialize(country_code, code) ⇒ BBAN
Returns a new instance of BBAN.
5 6 7 |
# File 'lib/bank_account_tools/bban.rb', line 5 def initialize(country_code, code) @country_code, @code = country_code, code end |
Instance Method Details
#country_applies_iban? ⇒ Boolean
26 27 28 |
# File 'lib/bank_account_tools/bban.rb', line 26 def country_applies_iban? !!specification end |
#to_s ⇒ Object
9 10 11 |
# File 'lib/bank_account_tools/bban.rb', line 9 def to_s @code end |
#valid? ⇒ Boolean
13 14 15 |
# File 'lib/bank_account_tools/bban.rb', line 13 def valid? valid_length? && !data.nil? end |
#valid_length? ⇒ Boolean
the bban is the iban minus the first 4 characters (country_code, check_digits)
18 19 20 |
# File 'lib/bank_account_tools/bban.rb', line 18 def valid_length? specification && specification['length'] - 4 == @code.length end |