Module: Anoubis::Core::Locales
- Defined in:
- app/models/anoubis/core/locales.rb
Overview
Defines all available locales.
Constant Summary collapse
- LIST =
List of all possible locales.
{ ru: { id: 1, name: 'Russian' }, en: { id: 2, name: 'English' }, kz: { id: 3, name: 'Kazakh' } }.freeze
Class Method Summary collapse
-
.enums ⇒ Symbol
Converts list of locales into enum attribute.
-
.name(key) ⇒ String
Returns the title of chosen locale.
Class Method Details
.enums ⇒ Symbol
Converts list of locales into enum attribute
23 24 25 |
# File 'app/models/anoubis/core/locales.rb', line 23 def enums LIST.reduce({}) { |res, v| res.merge("#{v.first}": v.last[:id]) } end |
.name(key) ⇒ String
Returns the title of chosen locale
16 17 18 |
# File 'app/models/anoubis/core/locales.rb', line 16 def name(key) LIST[key.to_sym][:name] end |