samuraicoder-fizzbuzzdazzkezz 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/fizzbuzzdazzkezz.rb +22 -0
  2. metadata +53 -0
@@ -0,0 +1,22 @@
1
+ =begin rdoc
2
+ Usage: (1..100).print_fizzbuzzdazzkezz(hash)
3
+ By default, the following Hash is presented:
4
+ {3 => :Fizz, 5 => :Buzz, 7 => :Dazz , 9 => :Kess}
5
+ We use symbols as it is cheaper than using strings.
6
+ =end
7
+
8
+
9
+ class Range
10
+ def print_fizzbuzzdazzkezz(hash = {7 => :Dazz, 5 => :Buzz, 3 => :Fizz , 9 => :Kess})
11
+ hash = hash
12
+ result = Array.new
13
+ self.each do |i|
14
+ str = ''
15
+ hash.sort.each do |key, value|
16
+ str += value.to_s if i.modulo(key).zero?
17
+ end
18
+ str = i if str.empty?
19
+ puts str
20
+ end
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: samuraicoder-fizzbuzzdazzkezz
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Takaaki Kato
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-10-27 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: takaaki@samuraicoder.net
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - lib/fizzbuzzdazzkezz.rb
26
+ has_rdoc: true
27
+ homepage: http://samuraicoder.net
28
+ post_install_message:
29
+ rdoc_options: []
30
+
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: 1.8.6
38
+ version:
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ requirements: []
46
+
47
+ rubyforge_project:
48
+ rubygems_version: 1.2.0
49
+ signing_key:
50
+ specification_version: 2
51
+ summary: When FizzBuzz is not enough.
52
+ test_files: []
53
+