Class: Fixnum

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

Overview

monkey patch for V3 - needs top level namespace

todo/fix: use refinements - why? why not?

Instance Method Summary collapse

Instance Method Details

#to_fizzbuzzObject



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

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