Skip to content

Commit

Permalink
Adding documentation to Translations class
Browse files Browse the repository at this point in the history
  • Loading branch information
rposborne committed Sep 20, 2016
1 parent eb4ba56 commit 4a8ebf4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/countries/translations.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
module ISO3166
# Extend the hash class to allow locale lookup fall back behavior
#
# ex:
# if a country has translations for pt, and the user looks up `pt-br` fallback
# to `pt` to prevent from showing nil values
class Translations < Hash
def [](locale)
super(locale) || super(locale.sub(/-.*/, ""))
Expand Down

0 comments on commit 4a8ebf4

Please sign in to comment.