This patch adds fizz?, buzz?, fizzbuzz? methods to Ruby's Numeric class.
First download source of Ruby. Then configure the source, and run make main install-nodoc.
ruby -e '(1..100).map{|i|('FizzBuzz' if i.fizzbuzz?)|| ('Fizz' if i.fizz?) || ('Buzz' if i.buzz?) || i}'
And you can run this code.
You're not extended Integer class. The fizzbuzz methods included in Ruby.
I want to include these methods include in Ruby master...

No comments:
Post a Comment