-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'trunk' into 188072189_update_billing_address_street_name
- Loading branch information
Showing
4 changed files
with
161 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
module AcaEntities | ||
module Atp | ||
module Functions | ||
|
||
# build tribal codes based on tribal name | ||
class TribeCodesBuilder | ||
TRIBAL_CODES_MAPPING = { | ||
"Maliseet" => "HM", | ||
"Passamaquoddy" => "PD", | ||
"Penobscot" => "PE", | ||
"Micmac" => "AM" | ||
}.freeze | ||
|
||
def call(tribe_name) | ||
find_codes(tribe_name) | ||
end | ||
|
||
def find_codes(tribe_name) | ||
codes = [] | ||
TRIBAL_CODES_MAPPING.each do |key, code| | ||
# Use a case-insensitive regex to match the key | ||
codes << code if tribe_name =~ /#{Regexp.escape(key)}/i | ||
end | ||
|
||
codes.present? ? codes : ["OT"] | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters