How do I find overlaps between two Ruby Runt patterns?

A

Amit Rawal

I am developing a Google like calendar on Rails and am using Runt to
define the recurrence patterns for creating events. However, the
restriction with the calendar is that there cannot be two events for
same time slot. So, if i have an event created with

event = REDay.new(13,00,15,00) # daily between 1PM to 3 PM

Then the application should not allow to create another event that
overlaps this one.

Is there some way of finding whether a Runt expression overlaps with
another expression?

I came across similar question at
http://stackoverflow.com/questions/831864/finding-schedule-overlaps-with-ruby-runt
and the solution says that "create a DateRange object from your expr and
then run overlap", but i am not sure how to do this. Also, what would
happen where there is no date range e.g. in the example given above
there is no start and end date.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top