Class: Fixnum

Inherits:
Object
  • Object
show all
Defined in:
lib/fizz-buzz.rb

Instance Method Summary collapse

Instance Method Details

#buzz?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/fizz-buzz.rb', line 38

def buzz?
  return true if (self % 5) == 0
end

#fizz?Boolean

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

3.fizz?       #  => true
5.buzz?       #  => nil
15.fizzbuzz?  #  => true

Returns:

  • (Boolean)


34
35
36
# File 'lib/fizz-buzz.rb', line 34

def fizz?
  return true if (self % 3) == 0
end

#fizzbuzz?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/fizz-buzz.rb', line 42

def fizzbuzz?
  return true if (self % 15) == 0
end