Class: Fixnum

Inherits:
Object
  • Object
show all
Defined in:
lib/fizzbuzzer.rb

Overview

monkey patch for Fixnum - note: use refinements (in the future) - why? why not?

Instance Method Summary collapse

Instance Method Details

#to_fizzbuzzObject



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/fizzbuzzer.rb', line 83

def to_fizzbuzz
  if self % 3 == 0 && self % 5 == 0
    "FizzBuzz"
  elsif self % 3 == 0
    "Fizz"
  elsif self % 5 == 0
    "Buzz"
  else
    self
  end
end