Class: ISO3166::Translations

Inherits:
Hash
  • Object
show all
Defined in:
lib/countries/translations.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#[](locale) ⇒ Object



8
9
10
# File 'lib/countries/translations.rb', line 8

def [](locale)
  super(locale) || super(locale.sub(/-.*/, ''))
end