Class: Translator

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

Instance Method Summary collapse

Constructor Details

#initialize(language) ⇒ Translator

Returns a new instance of Translator.



3
4
5
# File 'lib/hello_translator/translator.rb', line 3

def initialize(language)
  @language = language
end

Instance Method Details

#helloObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/hello_translator/translator.rb', line 7

def hello
  case @language
    when "arabic";
      "مرحبا"
    when "bulgarian";
      "Здравейте"
    when "danish";
      "Hallo"
    when "filipino";
      "kumusta"
    when "german";
      "Hallo"
    when "russian";
      "привет"
    when "turkish";
      "merhaba"
    when "french";
      "salut"
    when "slovak";
      "ahoj"
    else
      "hello"
  end
end