gem_tutorial_kcheung 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +8 -0
- data/lib/gem_tutorial_kcheung/translator.rb +9 -1
- data/lib/gem_tutorial_kcheung.rb +6 -0
- data/test/test_gem_tutorial_kcheung.rb +19 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abf6c5f3f1a351c4aa21d472d4dcabde7fdd9f4cd72a44a5581763b1d3fbe3e6
|
4
|
+
data.tar.gz: 9d9c78b1062f4df78fed797983f555ced682bd50b4606e92762c197be038a1f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d8c3123faefc3ee3cf18c64aded9297bbaea13893dc1f4e0a67f8dee616c8e7677d70bbd259ce248dbf2359b81769ff7579bf0fd0762d0d32b8e037ae263911
|
7
|
+
data.tar.gz: 129df06f77b97fc9b945921603b1d3d2b092eddbf9ed1d645de8e06db81133870009c4a8b03b582a479c201a7597a451c3903faad0afce33f2c5ec67fa44c5cf
|
data/Rakefile
ADDED
@@ -1,14 +1,22 @@
|
|
1
|
+
# This class is responsible for translating "hello world" based on the
|
2
|
+
# given language
|
1
3
|
class GemTutorial::Translator
|
4
|
+
# Initialize translator with language
|
5
|
+
#
|
6
|
+
# @param language [String] the language
|
2
7
|
def initialize(language)
|
3
8
|
@language = language
|
4
9
|
end
|
5
10
|
|
11
|
+
# Print 'hello world' depending on the class language passed in
|
12
|
+
#
|
13
|
+
# @return [nil] Prints 'hello world'.
|
6
14
|
def hi
|
7
15
|
case @language
|
8
16
|
when 'spanish'
|
9
17
|
'hola mundo'
|
10
18
|
else
|
11
|
-
'
|
19
|
+
'hello world'
|
12
20
|
end
|
13
21
|
end
|
14
22
|
end
|
data/lib/gem_tutorial_kcheung.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
+
# This class is responsible for exposing methods to be used from
|
2
|
+
# the gem
|
1
3
|
class GemTutorial
|
4
|
+
# Print 'hello world' depending on the language passed in
|
5
|
+
#
|
6
|
+
# @param language [String] the language
|
7
|
+
# @return [nil] Prints 'hello world'.
|
2
8
|
def self.hi(language = 'english')
|
3
9
|
translator = Translator.new(language)
|
4
10
|
translator.hi
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "gem_tutorial_kcheung"
|
3
|
+
|
4
|
+
class GemTutorialTest < Minitest::Test
|
5
|
+
def test_english_hello
|
6
|
+
assert_equal "hello world",
|
7
|
+
GemTutorial.hi("english")
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_any_hello
|
11
|
+
assert_equal "hello world",
|
12
|
+
GemTutorial.hi("ruby")
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_spanish_hello
|
16
|
+
assert_equal "hola mundo",
|
17
|
+
GemTutorial.hi("spanish")
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem_tutorial_kcheung
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kcheung
|
@@ -17,9 +17,11 @@ executables:
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- Rakefile
|
20
21
|
- bin/gem_tutorial_kcheung
|
21
22
|
- lib/gem_tutorial_kcheung.rb
|
22
23
|
- lib/gem_tutorial_kcheung/translator.rb
|
24
|
+
- test/test_gem_tutorial_kcheung.rb
|
23
25
|
homepage: https://rubygems.org/gems/gem_tutorial_kcheung
|
24
26
|
licenses:
|
25
27
|
- MIT
|
@@ -43,4 +45,5 @@ rubygems_version: 3.2.3
|
|
43
45
|
signing_key:
|
44
46
|
specification_version: 4
|
45
47
|
summary: gem tutorial!
|
46
|
-
test_files:
|
48
|
+
test_files:
|
49
|
+
- test/test_gem_tutorial_kcheung.rb
|