Method: AtlasEngine::FieldDecompounder#call

Defined in:
app/models/atlas_engine/field_decompounder.rb

#callObject



18
19
20
21
22
23
24
25
26
27
# File 'app/models/atlas_engine/field_decompounder.rb', line 18

def call
  country_profile.decompounding_patterns(field)&.each do |pattern|
    transliterated_street = ActiveSupport::Inflector.transliterate(value.to_s)
    if (match = transliterated_street.match(expanded_pattern(pattern)))
      return (match[:pre] + match[:name] + " " + match[:suffix] + match[:post]).strip
    end
  end

  value
end