fizz-buzz 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -0
- data/VERSION +1 -1
- data/fizz-buzz.gemspec +3 -2
- data/lib/fizz-buzz.rb +14 -3
- data/test/test_fizz-buzz.rb +8 -0
- metadata +12 -11
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/fizz-buzz.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fizz-buzz}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kerri Miller"]
|
12
|
-
s.date = %q{2011-11-
|
12
|
+
s.date = %q{2011-11-29}
|
13
13
|
s.description = %q{I got sick of doing this test in interviews, so next time someone asks me to do so, I'm going to instead hand them a business card with a URL for this gem on it.}
|
14
14
|
s.email = %q{kerrizor@kerrizor.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
+
".travis.yml",
|
21
22
|
"Gemfile",
|
22
23
|
"Gemfile.lock",
|
23
24
|
"LICENSE.txt",
|
data/lib/fizz-buzz.rb
CHANGED
@@ -23,13 +23,13 @@ class FizzBuzz
|
|
23
23
|
end
|
24
24
|
|
25
25
|
|
26
|
-
|
27
|
-
class Fixnum
|
28
|
-
|
26
|
+
module FizzBuzziness
|
29
27
|
# For testing the Fizz-, Buzz-, or Fizzbuzz-ness of a Fixnum
|
30
28
|
# 3.fizz? # => true
|
31
29
|
# 3.buzz? # => false
|
32
30
|
# 15.fizzbuzz? # => true
|
31
|
+
#
|
32
|
+
# Note that using these methods, fizzbuzzy numbers like 15 will fizz, buzz, AND fizzbuzz.
|
33
33
|
|
34
34
|
def fizz?
|
35
35
|
self % 3 == 0
|
@@ -42,5 +42,16 @@ class Fixnum
|
|
42
42
|
def fizzbuzz?
|
43
43
|
self % 15 == 0
|
44
44
|
end
|
45
|
+
end
|
46
|
+
|
45
47
|
|
48
|
+
class Fixnum
|
49
|
+
include FizzBuzziness
|
46
50
|
end
|
51
|
+
|
52
|
+
|
53
|
+
class Float
|
54
|
+
include FizzBuzziness
|
55
|
+
end
|
56
|
+
|
57
|
+
|
data/test/test_fizz-buzz.rb
CHANGED
@@ -6,10 +6,12 @@ class TestFizzBuzz < Test::Unit::TestCase
|
|
6
6
|
assert_instance_of FizzBuzz, FizzBuzz.new
|
7
7
|
end
|
8
8
|
|
9
|
+
|
9
10
|
def setup
|
10
11
|
@fizzbuzz = FizzBuzz.new
|
11
12
|
end
|
12
13
|
|
14
|
+
|
13
15
|
def test_crunch
|
14
16
|
assert_respond_to @fizzbuzz, :crunch
|
15
17
|
assert_kind_of Array, @fizzbuzz.crunch
|
@@ -37,6 +39,8 @@ class TestFizzBuzz < Test::Unit::TestCase
|
|
37
39
|
assert_respond_to 4, :fizz?
|
38
40
|
assert 3.fizz?
|
39
41
|
assert !2.fizz?
|
42
|
+
assert 3.0.fizz?
|
43
|
+
assert !3.1.fizz?
|
40
44
|
end
|
41
45
|
|
42
46
|
|
@@ -44,6 +48,8 @@ class TestFizzBuzz < Test::Unit::TestCase
|
|
44
48
|
assert_respond_to 4, :buzz?
|
45
49
|
assert 5.buzz?
|
46
50
|
assert !2.buzz?
|
51
|
+
assert 5.0.buzz?
|
52
|
+
assert !5.1.buzz?
|
47
53
|
end
|
48
54
|
|
49
55
|
|
@@ -51,6 +57,8 @@ class TestFizzBuzz < Test::Unit::TestCase
|
|
51
57
|
assert_respond_to 4, :fizzbuzz?
|
52
58
|
assert 30.fizzbuzz?
|
53
59
|
assert !2.fizzbuzz?
|
60
|
+
assert 30.0.fizzbuzz?
|
61
|
+
assert !30.1.fizzbuzz?
|
54
62
|
end
|
55
63
|
|
56
64
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fizz-buzz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11-
|
12
|
+
date: 2011-11-29 00:00:00.000000000 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: shoulda
|
17
|
-
requirement: &
|
17
|
+
requirement: &2181108320 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2181108320
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: bundler
|
28
|
-
requirement: &
|
28
|
+
requirement: &2181107840 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 1.0.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2181107840
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: jeweler
|
39
|
-
requirement: &
|
39
|
+
requirement: &2181107360 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 1.6.4
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *2181107360
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rcov
|
50
|
-
requirement: &
|
50
|
+
requirement: &2181106880 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,7 +55,7 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *2181106880
|
59
59
|
description: I got sick of doing this test in interviews, so next time someone asks
|
60
60
|
me to do so, I'm going to instead hand them a business card with a URL for this
|
61
61
|
gem on it.
|
@@ -67,6 +67,7 @@ extra_rdoc_files:
|
|
67
67
|
- README.rdoc
|
68
68
|
files:
|
69
69
|
- .document
|
70
|
+
- .travis.yml
|
70
71
|
- Gemfile
|
71
72
|
- Gemfile.lock
|
72
73
|
- LICENSE.txt
|
@@ -93,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
94
|
version: '0'
|
94
95
|
segments:
|
95
96
|
- 0
|
96
|
-
hash:
|
97
|
+
hash: -226548314513455172
|
97
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
99
|
none: false
|
99
100
|
requirements:
|