Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/hola.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# encoding: UTF-8

class Hola
def self.hi(language)
translator = Translator.new(language)
Expand Down
4 changes: 4 additions & 0 deletions lib/hola/translator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# encoding: UTF-8

class Hola::Translator
def initialize(language = "english")
@language = language
Expand All @@ -9,6 +11,8 @@ def hi
"hola mundo"
when "korean"
"anyoung ha se yo"
when "polish"
"witaj świecie"
else
"hello world"
end
Expand Down
6 changes: 6 additions & 0 deletions test/test_hola.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# encoding: UTF-8

require 'test/unit'
require 'hola'

Expand All @@ -13,4 +15,8 @@ def test_any_hello
def test_spanish_hello
assert_equal "hola mundo", Hola.hi("spanish")
end

def test_polish_hello
assert_equal "witaj świecie", Hola.hi("polish")
end
end