Created
November 14, 2012 17:14
-
-
Save deepakkumarnd/4073407 to your computer and use it in GitHub Desktop.
One small ruby puzzle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Roulette | |
| def method_missing(name, *args) | |
| person = name.to_s.capitalize | |
| 3.times do | |
| number = rand(10) + 1 | |
| puts "#{number}..." | |
| end | |
| "#{person} got a #{number}" | |
| end | |
| end | |
| number_of = Roulette.new | |
| puts number_of.bob | |
| puts number_of.frank |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment