hola_xprayc 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/hola ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'hola_xprayc'
4
+ puts Hola.hi(ARGV[0].to_sym)
@@ -0,0 +1,14 @@
1
+ class Hola::Translator
2
+ def initialize(language)
3
+ @language = language
4
+ end
5
+
6
+ def hi
7
+ case @language
8
+ when :spanish
9
+ "hola mundo"
10
+ else
11
+ "hello world"
12
+ end
13
+ end
14
+ end
data/lib/hola_xprayc.rb CHANGED
@@ -1,5 +1,17 @@
1
1
  class Hola
2
- def self.hi
3
- puts "Hello world!"
2
+ # Say hi to the world!
3
+ #
4
+ # Example:
5
+ # >> Hola.hi(:spanish)
6
+ # => hola mundo
7
+ #
8
+ # Arguments:
9
+ # language: (Symbol)
10
+
11
+ def self.hi(language = :english)
12
+ translator = Translator.new(language)
13
+ translator.hi
4
14
  end
5
15
  end
16
+
17
+ require 'hola_xprayc/translator'
@@ -0,0 +1,19 @@
1
+ require 'test/unit'
2
+ require 'hola_xprayc'
3
+
4
+ class HolaTest < Test::Unit::TestCase
5
+ def test_english_hello
6
+ assert_equal "hello world",
7
+ Hola.hi(:english)
8
+ end
9
+
10
+ def test_any_hello
11
+ assert_equal "hello world",
12
+ Hola.hi(:ruby)
13
+ end
14
+
15
+ def test_spanish_hello
16
+ assert_equal "hola mundo",
17
+ Hola.hi(:spanish)
18
+ end
19
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hola_xprayc
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:
@@ -13,13 +13,18 @@ date: 2012-01-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A simple hello world gem
15
15
  email: xprayc@gmail.com
16
- executables: []
16
+ executables:
17
+ - hola
17
18
  extensions: []
18
19
  extra_rdoc_files: []
19
20
  files:
20
21
  - lib/hola_xprayc.rb
21
- homepage: http://rubygems.org/gems/hola
22
- licenses: []
22
+ - lib/hola_xprayc/translator.rb
23
+ - test/test_hola_xprayc.rb
24
+ - bin/hola
25
+ homepage: http://rubygems.org/gems/hola_xprayc
26
+ licenses:
27
+ - MIT
23
28
  post_install_message:
24
29
  rdoc_options: []
25
30
  require_paths:
@@ -42,5 +47,6 @@ rubygems_version: 1.8.24
42
47
  signing_key:
43
48
  specification_version: 3
44
49
  summary: Hola!
45
- test_files: []
50
+ test_files:
51
+ - test/test_hola_xprayc.rb
46
52
  has_rdoc: