Skip to content

Instantly share code, notes, and snippets.

@InertialObserver
Created April 6, 2015 02:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save InertialObserver/cfec57575a23980c9266 to your computer and use it in GitHub Desktop.
Save InertialObserver/cfec57575a23980c9266 to your computer and use it in GitHub Desktop.
class Fixnum
define_method(:pingpong) do
1.upto(self).each do |number|
ping = (number % 3 == 0)
pong = (number % 5 == 0)
if ping && pong
puts "PingPong"
elsif ping
puts "Ping"
elsif pong
puts "Pong"
else
puts number
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment