hola 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << 'test'
5
+ end
6
+
7
+ desc "Run tests"
8
+ task :default => :test
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'hola'
4
+ puts Hola.hi(ARGV[0])
@@ -1,5 +1,8 @@
1
1
  class Hola
2
- def self.hi
3
- puts "Hello world!"
2
+ def self.hi(language)
3
+ translator = Translator.new(language)
4
+ translator.hi
4
5
  end
5
6
  end
7
+
8
+ require 'hola/translator'
@@ -0,0 +1,14 @@
1
+ class Hola::Translator
2
+ def initialize(language = "english")
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
@@ -0,0 +1,16 @@
1
+ require 'test/unit'
2
+ require 'hola'
3
+
4
+ class HolaTest < Test::Unit::TestCase
5
+ def test_english_hello
6
+ assert_equal "hello world", Hola.hi("english")
7
+ end
8
+
9
+ def test_any_hello
10
+ assert_equal "hello world", Hola.hi("ruby")
11
+ end
12
+
13
+ def test_spanish_hello
14
+ assert_equal "hola mundo", Hola.hi("spanish")
15
+ end
16
+ end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hola
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 0
9
- - 0
10
- version: 0.0.0
4
+ prerelease:
5
+ version: 0.0.1
11
6
  platform: ruby
12
7
  authors:
13
8
  - Nick Quaranto
@@ -15,8 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2010-10-03 00:00:00 -04:00
19
- default_executable:
13
+ date: 2010-04-03 00:00:00 Z
20
14
  dependencies: []
21
15
 
22
16
  description: A simple hello world gem
@@ -28,8 +22,11 @@ extensions: []
28
22
  extra_rdoc_files: []
29
23
 
30
24
  files:
25
+ - Rakefile
31
26
  - lib/hola.rb
32
- has_rdoc: true
27
+ - lib/hola/translator.rb
28
+ - bin/hola
29
+ - test/test_hola.rb
33
30
  homepage: http://rubygems.org/gems/hola
34
31
  licenses: []
35
32
 
@@ -43,25 +40,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
43
40
  requirements:
44
41
  - - ">="
45
42
  - !ruby/object:Gem::Version
46
- hash: 3
47
- segments:
48
- - 0
49
43
  version: "0"
50
44
  required_rubygems_version: !ruby/object:Gem::Requirement
51
45
  none: false
52
46
  requirements:
53
47
  - - ">="
54
48
  - !ruby/object:Gem::Version
55
- hash: 3
56
- segments:
57
- - 0
58
49
  version: "0"
59
50
  requirements: []
60
51
 
61
52
  rubyforge_project:
62
- rubygems_version: 1.3.7
53
+ rubygems_version: 1.8.5
63
54
  signing_key:
64
55
  specification_version: 3
65
56
  summary: Hola!
66
- test_files: []
67
-
57
+ test_files:
58
+ - test/test_hola.rb