0.01
No release in over 3 years
Low commit activity in last 3 years
Validate and normalise United Kingdom bank account numbers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3
>= 12.3.3

Runtime

 Project Readme

United Kingdom bank tools

Ruby CI

Ruby gem to validate United Kingdom sort codes and bank account numbers.

When in doubt, this library aims to err on the side of allowing too much.

If we got anything wrong, please file an issue or contribute a fix yourself.

Usage

# Sort code

sort_code = BankTools::GB::SortCode.new("60-16-13")
sort_code.valid?  # => true
sort_code.errors  # => []

bad_sort_code = BankTools::GB::SortCode.new("1X")
bad_sort_code.valid?  # => false
bad_sort_code.errors  # => [ :too_short, :invalid_characters ]

# Account

account = BankTools::GB::Account.new("31926819")
account.valid?  # => true
account.errors  # => []

bad_account = BankTools::GB::Account.new("1")
bad_account.valid?  # => false
bad_account.errors  # => [ :too_short ]

Installation

Add this line to your application's Gemfile:

gem "banktools-gb"

And then execute:

$ bundle

Or install it yourself as:

$ gem install banktools-gb

Tests

bundle
rspec  # or: rake

Also see

Credits

License

The gem is available as open source under the terms of the MIT License.