From 4a8ebf45bc6644e509607e1f87833061e2e56ad7 Mon Sep 17 00:00:00 2001 From: Russell Osborne Date: Mon, 19 Sep 2016 23:28:16 -0400 Subject: [PATCH] Adding documentation to Translations class --- lib/countries/translations.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/countries/translations.rb b/lib/countries/translations.rb index 6463d4136..eca88f190 100644 --- a/lib/countries/translations.rb +++ b/lib/countries/translations.rb @@ -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(/-.*/, ""))