Class: AtlasEngine::Pl::ValidationTranscriber::AddressParser
- Inherits:
-
ValidationTranscriber::AddressParserBase
- Object
- ValidationTranscriber::AddressParserBase
- AtlasEngine::Pl::ValidationTranscriber::AddressParser
- Defined in:
- app/countries/atlas_engine/pl/validation_transcriber/address_parser.rb
Constant Summary collapse
- STREET =
the .+ is non-greedy to allow for optional building number prefixes
"(?<street>.+?)"
- BUILDING_NUM_PREFIX =
"(?:nr.?\s+)"
- BUILDING_NUM =
"(?<building_num>[0-9]+[[:alpha:]]*)"
- UNIT_NUM_PREFIX =
"(?:\s*[/-]|\s+m.?)"
- UNIT_NUM =
"(?<unit_num>[[:alpha:]0-9]+)"
Constants inherited from ValidationTranscriber::AddressParserBase
ValidationTranscriber::AddressParserBase::AddressComponents, ValidationTranscriber::AddressParserBase::BUILDING_NAME, ValidationTranscriber::AddressParserBase::NON_NUMERIC_STREET, ValidationTranscriber::AddressParserBase::NUMERIC_ONLY_BUILDING_NUM, ValidationTranscriber::AddressParserBase::PO_BOX, ValidationTranscriber::AddressParserBase::STREET_NO_COMMAS, ValidationTranscriber::AddressParserBase::UNIT_NUM_NO_HYPHEN, ValidationTranscriber::AddressParserBase::UNIT_TYPE
Instance Method Summary collapse
Methods inherited from ValidationTranscriber::AddressParserBase
Methods included from ValidationTranscriber::Formatter
#build_address, #strip_trailing_punctuation, #strip_word
Constructor Details
This class inherits a constructor from AtlasEngine::ValidationTranscriber::AddressParserBase
Instance Method Details
#parse ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/countries/atlas_engine/pl/validation_transcriber/address_parser.rb', line 15 def parse # polish addressses sometimes follow an abbreviation with a period and no space afterward super.each do |components| components[:street]&.gsub!( /\A(?<prefix>.+?)(?<dot>\.)(?<non_space>\S)/i, "\\k<prefix> \\k<non_space>", ) end end |