Class: HelloANPRichter::Translator

Inherits:
Object
  • Object
show all
Defined in:
lib/hello_anprichter/translator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#languageObject (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

#translateObject



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