Class: TranslationOption
- Inherits:
-
Object
- Object
- TranslationOption
- Defined in:
- lib/models/translation_option.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#description ⇒ Object
Returns the value of attribute description.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code, description) ⇒ TranslationOption
constructor
A new instance of TranslationOption.
Constructor Details
#initialize(code, description) ⇒ TranslationOption
Returns a new instance of TranslationOption.
6 7 8 |
# File 'lib/models/translation_option.rb', line 6 def initialize(code, description) @code, @description = code, description end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
3 4 5 |
# File 'lib/models/translation_option.rb', line 3 def code @code end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/models/translation_option.rb', line 3 def description @description end |
Class Method Details
.all ⇒ Object
10 11 12 |
# File 'lib/models/translation_option.rb', line 10 def self.all [untranslated, translated] end |
.find(code) ⇒ Object
22 23 24 |
# File 'lib/models/translation_option.rb', line 22 def self.find(code) all.detect{|option| option.code == code} || untranslated end |
.translated ⇒ Object
14 15 16 |
# File 'lib/models/translation_option.rb', line 14 def self.translated @@translated ||= TranslationOption.new('translated', 'Translated') end |
.untranslated ⇒ Object
18 19 20 |
# File 'lib/models/translation_option.rb', line 18 def self.untranslated @@untranslated ||= TranslationOption.new('untranslated', 'Untranslated') end |