Class: Language
- Inherits:
-
Object
- Object
- Language
- Defined in:
- app/models/language.rb
Constant Summary collapse
- LANGUAGES =
{ ENGLISH: 'E', FRENCH: 'F' }
- ENGLISH =
{ value: LANGUAGES[:ENGLISH], label: I18n.t('languages.english'), locale: :en }
- FRENCH =
{ value: LANGUAGES[:FRENCH], label: I18n.t('languages.french'), locale: :fr }
Class Method Summary collapse
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(value) ⇒ Language
constructor
A new instance of Language.
- #locale ⇒ Object
- #to_h ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(value) ⇒ Language
Returns a new instance of Language.
28 29 30 |
# File 'app/models/language.rb', line 28 def initialize(value) @value = value end |
Class Method Details
Instance Method Details
#description ⇒ Object
41 42 43 |
# File 'app/models/language.rb', line 41 def description to_h[:label] end |
#locale ⇒ Object
45 46 47 |
# File 'app/models/language.rb', line 45 def locale to_h[:locale] end |
#to_h ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'app/models/language.rb', line 32 def to_h case @value when LANGUAGES[:ENGLISH] ENGLISH when LANGUAGES[:FRENCH] FRENCH end end |
#value ⇒ Object
49 50 51 |
# File 'app/models/language.rb', line 49 def value to_h[:value] end |