module FizzBuzzNumerics

Public Instance Methods

buzz?() click to toggle source
# File lib/fizz-buzz.rb, line 34
def buzz?
  self % 5 == 0
end
fizz?() click to toggle source

For testing the Fizz-, Buzz-, or Fizzbuzz-ness of a Fixnum

3.fizz?       #  => true
3.buzz?       #  => false
15.fizzbuzz?  #  => true

Note that using these methods, fizzbuzzy numbers like 15 will fizz, buzz, AND fizzbuzz.

# File lib/fizz-buzz.rb, line 30
def fizz?
  self % 3 == 0
end
fizzbuzz?() click to toggle source
# File lib/fizz-buzz.rb, line 38
def fizzbuzz?
  self % 15 == 0
end