#!/usr/local/bin/ruby module FizzBuzz refine Integer do def fizzbuzz() fz = '' fz += 'Fizz' if self % 3 == 0 fz += 'Buzz' if self % 5 == 0 if (fz == '') then self.to_s else fz end end end end 1.upto 30 do |n| using FizzBuzz puts n.fizzbuzz end