From c2516eb7a264837faedcd729b074f9d2dfe34c52 Mon Sep 17 00:00:00 2001 From: Dmitriy Bukholtsev Date: Tue, 21 Jan 2025 15:28:38 +0700 Subject: [PATCH] normalize_bank_name function (#36) --- Gemfile.lock | 2 +- lib/umbrellio_utils/misc.rb | 10 ++++++++++ lib/umbrellio_utils/version.rb | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 648d082..1476350 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - umbrellio-utils (1.5.5) + umbrellio-utils (1.6.0) memery (~> 1) GEM diff --git a/lib/umbrellio_utils/misc.rb b/lib/umbrellio_utils/misc.rb index 98f3986..62e157b 100644 --- a/lib/umbrellio_utils/misc.rb +++ b/lib/umbrellio_utils/misc.rb @@ -63,5 +63,15 @@ def reset_defaults_for_hash(hash) end end end + + # needs any_ascii gem to work + def normalize_bank_name(name) + result = AnyAscii.transliterate(name).gsub(/[^A-Za-z0-9]+/, " ").upcase.squish + result.sub!(/\ATHE\s+/, "") + result.sub!(/\bLIMITED\b/, "LTD") + result.sub!(/\bCOMPANY\b/, "CO") + result.sub!(/\bCORPORATION\b/, "CORP") + result + end end end diff --git a/lib/umbrellio_utils/version.rb b/lib/umbrellio_utils/version.rb index 968ef5d..1eb0de0 100644 --- a/lib/umbrellio_utils/version.rb +++ b/lib/umbrellio_utils/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module UmbrellioUtils - VERSION = "1.5.5" + VERSION = "1.6.0" end