class FizzBuzzer::V4::Fizznum

Public Class Methods

new(n) click to toggle source
# File lib/fizzbuzzer.rb, line 107
def initialize(n)
  @n = n
end

Public Instance Methods

buzz?() click to toggle source
# File lib/fizzbuzzer.rb, line 113
def buzz?()     @n % 5 == 0;  end
fizz?() click to toggle source
# File lib/fizzbuzzer.rb, line 112
def fizz?()     @n % 3 == 0;  end
fizzbuzz?() click to toggle source
# File lib/fizzbuzzer.rb, line 111
def fizzbuzz?() @n % 3 == 0 && @n % 5 == 0;  end
val() click to toggle source
# File lib/fizzbuzzer.rb, line 115
def val
  if    fizzbuzz? then "FizzBuzz"
  elsif fizz?     then "Fizz"
  elsif buzz?     then "Buzz"
  else  @n
  end
end