Class: AtlasEngine::ValidationTranscriber::AddressParserPreprocessor
- Inherits:
-
Object
- Object
- AtlasEngine::ValidationTranscriber::AddressParserPreprocessor
- Extended by:
- T::Sig
- Includes:
- AddressParsingHelper, Formatter
- Defined in:
- app/lib/atlas_engine/validation_transcriber/address_parser_preprocessor.rb
Instance Method Summary collapse
- #generate_combinations ⇒ Object
-
#initialize(address:) ⇒ AddressParserPreprocessor
constructor
A new instance of AddressParserPreprocessor.
Methods included from AddressParsingHelper
#address_constants, #directional?, #street_suffix?
Methods included from Formatter
#build_address, #strip_trailing_punctuation, #strip_word
Constructor Details
#initialize(address:) ⇒ AddressParserPreprocessor
Returns a new instance of AddressParserPreprocessor.
16 17 18 19 20 21 22 |
# File 'app/lib/atlas_engine/validation_transcriber/address_parser_preprocessor.rb', line 16 def initialize(address:) raise ArgumentError, "country_code cannot be blank in address" if address.country_code.blank? @country = T.let(Worldwide.region(code: address.country_code), Worldwide::Region) @address = address @combinations = T.let(Set.new, T::Set[T.nilable(String)]) end |
Instance Method Details
#generate_combinations ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'app/lib/atlas_engine/validation_transcriber/address_parser_preprocessor.rb', line 25 def generate_combinations @combinations << @address.address1 @combinations << @address.address2 @combinations << combined_address_lines @combinations << address_1_stripped_of_known_components_excluding_zip @combinations << address_1_stripped_of_known_components @combinations << address_1_sliced_on_street @combinations.compact_blank.uniq end |