Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated SwissMatch::ZipCode#transliterated_names, it now considers sh…

…ort names too and is faster.
  • Loading branch information...
commit 66dde40b165c1045357b3195d09be66781baec3b 1 parent 4070167
@apeiros authored
Showing with 5 additions and 7 deletions.
  1. +5 −7 lib/swissmatch/zipcode.rb
View
12 lib/swissmatch/zipcode.rb
@@ -145,15 +145,13 @@ def initialize(
# @return [Array<String>]
# The name of this zip code in all languages and normalizations (only unique values)
def transliterated_names
- names.flat_map { |name, ary|
- name = name.to_s # convert from SwissMatch::Name
- [
- SwissMatch.transliterate1(name),
- SwissMatch.transliterate2(name) # TODO: use transliterate gem
- ]
- }.uniq
+ (
+ @all_names.map { |name| SwissMatch.transliterate1(name) } |
+ @all_names.map { |name| SwissMatch.transliterate2(name) }
+ ).uniq
end
+
# Since a zip code can - for any given language - have no name, exactly one name,
# or even multiple names, it is sometimes difficult to write good code to
# automatically provide well localized addresses. This method helps with that, in that
Please sign in to comment.
Something went wrong with that request. Please try again.