Sha256: f1535f36f4cf51fb224337ae47ef066a66e246dafb80962fc74bfa106e7fee8c

Contents?: true

Size: 568 Bytes

Versions: 1

Compression:

Stored size: 568 Bytes

Contents

class FizzBuzz
  def crunch
    return_values = Array.new

    (1..100).each do |n|
      if n.fizzbuzz?
         return_values << "FizzBuzz"
      elsif n.buzz?
        return_values << "Buzz"
      elsif n.fizz?
        return_values << "Fizz"
      else
        return_values << n
      end
    end

    return return_values
  end
end

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

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

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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fizz-buzz-0.2.0 lib/fizz-buzz.rb