Hi Friend! This is a static copy of Mendicant's old Community Site. This project has been sunset therefore we are no longer updating it. For the latest news about the school, check out our main site. Thanks for visiting!
Tempr - no fussin' temporal expressions

I just released Tempr, a library for lazily building and evaluating temporal expressions. I'd be glad for any comments!

My motivation in writing this was to replace the old Runt library we use in MU's Scheduler, which can't run in Ruby 1.9.x.

What the heck are temporal expressions, you ask?

Say you have an appointment every third Thursday of each month at 12:30pm, for an hour . If you want a list of all such appointments for a given date range, using Tempr it's:

range.extend(Tempr::DateTimeRange)
appointments = range.each_month.thursday(2).each_time_of_day("12:30pm", 60*60)
appointments.to_a

or you want to know if another time conflicts?

appointments.cover?(another_time)

Tempr makes this sort of thing easy, and cleans up code that would otherwise be doing a bunch of low level manual date processing.

Update: I've re-written the Scheduler using Tempr.

« There is more where that came from