0.0
No commit activity in last 3 years
No release in over 3 years
Makes all multiples of 3 print as FIZZ, etc etc
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
 Project Readme

FizzBuzzard

Get the goodness of FizzBuzz in all of your apps

Fizzbuzz is a popular interview question for programmers (so I've read, I've never been asked it).

It goes like this:

Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz". from Coding Horror

Not difficult. But why restrict the magic of FizzBuzz to an interview, throwing away perfectly working code you could be using in production?

Now you don't have to. FizzBuzzard monkey patches Fixnum so that all multiples of 3 display as "FIZZ", all multiples of 5 as "BUZZ", and all multiples of 3 and 5 as "FIZZBUZZ". All the way through your program, for absolutely every Fixnum.

Here's how to use it:

gem 'fizzbuzzard' # in your Gemfile

require 'fizzbuzzard'

puts 3  # => "FIZZ"
puts 5  # => "BUZZ"
puts 15 # => "FIZZBUZZ"

(1..100).each { |n| puts n } # solves FizzBuzz!!

Donations are what keeps this project alive. Please send money. Please.

Oh, and in case you're interested, here's the current test status:

(0h8m|master) [fizzbuzzard] $ rspec
.

Finished in 0 seconds
1 example, FIZZBUZZ failures

Please let me know your success stories using FizzBuzzard in your enterprise projects. I'm @rsslldnphy on that Twitter.