Class: HelloANPRichter::Translator
- Inherits:
-
Object
- Object
- HelloANPRichter::Translator
- Defined in:
- lib/hello_anprichter/translator.rb
Instance Attribute Summary collapse
-
#language ⇒ Object
readonly
Returns the value of attribute language.
Instance Method Summary collapse
-
#initialize(language) ⇒ Translator
constructor
A new instance of Translator.
- #translate ⇒ Object
Constructor Details
#initialize(language) ⇒ Translator
Returns a new instance of Translator.
5 6 7 |
# File 'lib/hello_anprichter/translator.rb', line 5 def initialize(language) @language = language end |
Instance Attribute Details
#language ⇒ Object (readonly)
Returns the value of attribute language.
3 4 5 |
# File 'lib/hello_anprichter/translator.rb', line 3 def language @language end |
Instance Method Details
#translate ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/hello_anprichter/translator.rb', line 9 def translate case @language when 'french' 'Bonjour' when 'german' 'Hallo' end end |