hello_yunan 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/hello/translator.rb +14 -0
  2. data/lib/hello.rb +6 -3
  3. metadata +2 -1
@@ -0,0 +1,14 @@
1
+ class Translator
2
+ def initialize(language)
3
+ @language = language
4
+ end
5
+
6
+ def hi
7
+ case @language
8
+ when "indonesia"
9
+ "hai dunia !"
10
+ else
11
+ "hello world"
12
+ end
13
+ end
14
+ end
data/lib/hello.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  class Hello
2
- def self.hi
3
- puts "Hello world!"
2
+ def self.hi(language = "indonesia")
3
+ translator = Translator.new(language)
4
+ translator.hi
4
5
  end
5
- end
6
+ end
7
+
8
+ require 'hello/translator'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hello_yunan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -18,6 +18,7 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - lib/hello.rb
21
+ - lib/hello/translator.rb
21
22
  homepage: http://rubygems.org/gems/hello_yunan
22
23
  licenses:
23
24
  - MIT