buzzfizz 1.0.0
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 +7 -0
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +11 -0
- data/buzzfizz.gemspec +23 -0
- data/lib/buzzfizz/enumerable.rb +13 -0
- data/lib/buzzfizz/numeric.rb +11 -0
- data/lib/buzzfizz/version.rb +3 -0
- data/lib/buzzfizz.rb +5 -0
- data/test/test_enumerable.rb +25 -0
- data/test/test_numeric.rb +30 -0
- metadata +87 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: ed9181b21844d98f3429d4f5f88ab69c58b888ff
|
|
4
|
+
data.tar.gz: 730a7e6d462807fed399e043ad729c13207c4ae3
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 9c78f0c3172513813e3460933ac9c2ed97c439d65cff20fb79bfaca64494caca59308e171239325f8fdbc266e074089ad780621cdcd801dff66e42cec8b71463
|
|
7
|
+
data.tar.gz: eb9aa98711f3d49cc71b0967e4805bff8fb5aef67991896c305bf63d869f84f16a4e315d4db44625d9d5fdc00afa37c6a61f10fbad40dd740424c9ce164e6feb
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 Hunter Haydel
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Buzzfizz
|
|
2
|
+
|
|
3
|
+
Makes solving fizzbuzz a breeze with horrible monkey patches!
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
gem 'fizzbuzz'
|
|
10
|
+
|
|
11
|
+
And then execute:
|
|
12
|
+
|
|
13
|
+
$ bundle
|
|
14
|
+
|
|
15
|
+
Or install it yourself as:
|
|
16
|
+
|
|
17
|
+
$ gem install fizzbuzz
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
(1.100).fizzbuzz
|
|
23
|
+
[1,2,3,4,5].fizzbuzz
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Contributing
|
|
27
|
+
|
|
28
|
+
1. Fork it
|
|
29
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
30
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
31
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
32
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/buzzfizz.gemspec
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'buzzfizz/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "buzzfizz"
|
|
8
|
+
spec.version = Buzzfizz::VERSION
|
|
9
|
+
spec.authors = ["Hunter Haydel"]
|
|
10
|
+
spec.email = ["haydh530@gmail.com"]
|
|
11
|
+
spec.summary = "Makes solving fizzbuzz a breeze with horrible monkey patches!"
|
|
12
|
+
spec.description = spec.summary
|
|
13
|
+
spec.homepage = "http://www.github.com/wedgex/buzzfizz"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files`.split($/)
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
|
22
|
+
spec.add_development_dependency "rake"
|
|
23
|
+
end
|
data/lib/buzzfizz.rb
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'buzzfizz'
|
|
2
|
+
require 'minitest'
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
|
|
5
|
+
class TestEnumerable < MiniTest::Test
|
|
6
|
+
def test_array
|
|
7
|
+
assert_equal %w(1 2 fizz 4 buzz fizz 7 8 fizz buzz), [1,2,3,4,5,6,7,8,9,10].fizzbuzz_array
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def test_range
|
|
11
|
+
assert_equal %w(1 2 fizz 4 buzz fizz 7 8 fizz buzz), (1..10).fizzbuzz_array
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_non_fizzbuzz_objects
|
|
15
|
+
assert_equal [nil, nil], [nil, Object.new].fizzbuzz_array
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_fizzbuzz
|
|
19
|
+
out, err = capture_io do
|
|
20
|
+
(1..3).fizzbuzz
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
assert_equal "1\n2\nfizz\n", out
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'buzzfizz'
|
|
2
|
+
require 'minitest'
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TestNumeric < MiniTest::Test
|
|
7
|
+
def test_fizz
|
|
8
|
+
assert_equal 'fizz', 3.fizzbuzz
|
|
9
|
+
assert_equal 'fizz', 6.fizzbuzz
|
|
10
|
+
assert_equal 'fizz', 9.fizzbuzz
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_buzz
|
|
14
|
+
assert_equal 'buzz', 5.fizzbuzz
|
|
15
|
+
assert_equal 'buzz', 10.fizzbuzz
|
|
16
|
+
assert_equal 'buzz', 20.fizzbuzz
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def test_fizzbuzz
|
|
20
|
+
assert_equal 'fizzbuzz', 15.fizzbuzz
|
|
21
|
+
assert_equal 'fizzbuzz', 30.fizzbuzz
|
|
22
|
+
assert_equal 'fizzbuzz', 45.fizzbuzz
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_other
|
|
26
|
+
assert_equal '1', 1.fizzbuzz
|
|
27
|
+
assert_equal '2', 2.fizzbuzz
|
|
28
|
+
assert_equal '4', 4.fizzbuzz
|
|
29
|
+
end
|
|
30
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: buzzfizz
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Hunter Haydel
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-09-03 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.3'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ~>
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.3'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
description: Makes solving fizzbuzz a breeze with horrible monkey patches!
|
|
42
|
+
email:
|
|
43
|
+
- haydh530@gmail.com
|
|
44
|
+
executables: []
|
|
45
|
+
extensions: []
|
|
46
|
+
extra_rdoc_files: []
|
|
47
|
+
files:
|
|
48
|
+
- .gitignore
|
|
49
|
+
- Gemfile
|
|
50
|
+
- LICENSE.txt
|
|
51
|
+
- README.md
|
|
52
|
+
- Rakefile
|
|
53
|
+
- buzzfizz.gemspec
|
|
54
|
+
- lib/buzzfizz.rb
|
|
55
|
+
- lib/buzzfizz/enumerable.rb
|
|
56
|
+
- lib/buzzfizz/numeric.rb
|
|
57
|
+
- lib/buzzfizz/version.rb
|
|
58
|
+
- test/test_enumerable.rb
|
|
59
|
+
- test/test_numeric.rb
|
|
60
|
+
homepage: http://www.github.com/wedgex/buzzfizz
|
|
61
|
+
licenses:
|
|
62
|
+
- MIT
|
|
63
|
+
metadata: {}
|
|
64
|
+
post_install_message:
|
|
65
|
+
rdoc_options: []
|
|
66
|
+
require_paths:
|
|
67
|
+
- lib
|
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
69
|
+
requirements:
|
|
70
|
+
- - '>='
|
|
71
|
+
- !ruby/object:Gem::Version
|
|
72
|
+
version: '0'
|
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
|
+
requirements:
|
|
75
|
+
- - '>='
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: '0'
|
|
78
|
+
requirements: []
|
|
79
|
+
rubyforge_project:
|
|
80
|
+
rubygems_version: 2.0.2
|
|
81
|
+
signing_key:
|
|
82
|
+
specification_version: 4
|
|
83
|
+
summary: Makes solving fizzbuzz a breeze with horrible monkey patches!
|
|
84
|
+
test_files:
|
|
85
|
+
- test/test_enumerable.rb
|
|
86
|
+
- test/test_numeric.rb
|
|
87
|
+
has_rdoc:
|