Re: Timers, scheduling and Ruby

here’s what i’d like

inclusive_endpoint = Time.now + 7.days
^^^^^^^^
is there already a library/utility for the above somewhere?

                                   #   runt.next_times 
 inclusive_endpoint = now + sleep_interval

make sense?
think so; will try to add this weekend. If I have questions may I
contact you offline? (I’m subscribed to CLR w/my work address – cc’d
address above is perfect!)

thanks for a great lib btw!

np, thanks for the kind words! …anyway, Martin F. did all the hard
work by coming up with the pattern in the first place…

Have a nice weekend all!

Matt

mlipper__at__gmail_dot_com

On Sat, 2 Dec 2006, Lipper, Matthew wrote:

inclusive_endpoint = Time.now + 6.days
^^^^^^^^
is there already a library/utility for the above somewhere?

written many times, but here’s mine:

class Numeric
def microseconds() Float(self * (10 ** -6)) end
def milliseconds() Float(self * (10 ** -3)) end
def seconds() self end
def minutes() 60 * seconds end
def hours() 60 * minutes end
def days() 24 * hours end
def weeks() 7 * days end
def months() 30 * days end
def years() 365 * days end
def decades() 10 * years end

 %w[
   microseconds milliseconds seconds minutes hours days weeks months 

years decades
].each{|m| alias_method m.chop, m}
end

you don’t have to write that part :wink:

make sense?

think so; will try to add this weekend. If I have questions may I contact
you offline? (I’m subscribed to CLR w/my work address – cc’d address above
is perfect!)

absolutely.

np, thanks for the kind words! …anyway, Martin F. did all the hard

i dunno about that - having transcribed quite a few books/articles into
code
myself - it’s hard wrapping your head around someone else’s ideas/code.

cheers.

-a