Class: FizzBuzz
- Inherits:
-
Object
- Object
- FizzBuzz
- Defined in:
- lib/fizzbuzz.rb
Class Method Summary collapse
Class Method Details
.check_fizzbuzz(n) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/fizzbuzz.rb', line 4 def check_fizzbuzz(n) if n % 15 == 0 "#{n} FizzBuzz" elsif n % 3 == 0 "#{n} Fizz" elsif n % 5 == 0 "#{n} Buzz" end end |
.fizzbuzz(*args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fizzbuzz.rb', line 14 def fizzbuzz(*args) start = args[0] stop = args[1] check = ErrorHandle.error_check(*args) if check (start..stop).each do |i| puts " #{check_fizzbuzz(i)}" unless check_fizzbuzz(i).nil? end end end |