I have a loop that needs to sleep before continuing to the next iteration, so I multiply the seconds * 60 to get the number of minutes. Instead of doing something like "sleep 10 * 60" for ten minutes, I want to make it a little prettier. I'm trying to do this: "sleep 10.minutes". I don't want to do this: "sleep minutes(10)"
I'm trying to override Fixnum to add a method called 'minutes', but I can't grab the '15' from '15.minutes'. Here's the code I'm using:
class Fixnum
def minutes
15 # need to find out the value entered here
end
end
The code above works, but I have to return the value I want inside of Fixnum.minutes - how do I find out what number was entered before .minutes?
I don't want to pass an argument because it looks different.