Does your schedule search overlap with Ruby & Runt?

I am using Ruby on Rails to create a simple application to keep track of store open and close times and appointments, and I am having some trouble checking for appointments and closings in store schedules.

I used Runt for scheduling. For example, if a store is open Monday morning from 9 am to 12 pm, closes for an hour for lunch, and then opens in the afternoon until 5 pm, it would look like this:

require 'runt'
include Runt

monday = DIWeek.new(Mon)
morning = REDay.new(9,00,12,00)
afternoon = REDAy.new(13,00,17,00)

expr = monday & morning & afternoon

      

For a given meeting (also Runt Temporal Expression), how can I make sure that the appointment does it overlap with the opening time, rather than overlap with lunch (or other times before or after opening time)?

I understand Runt has overlaps? method, but if I do something like:

expr.overlaps?(DIWeek.new(Mon) & REDay.new(10,00,11,00)) # the appointment is from 10-11am on Monday and should overlap the morning opening time

      

I am getting this error:

NoMethodError: undefined method `overlaps?' for #<Runt::Intersect:0x10483cc>

      

Can anyone advise me on how to fix this error or another way to fix this problem?

0


a source to share


1 answer


Overlapping? the method is defined only in Runt :: Collection and Runt :: DateRange. Perhaps you can create a DateRange object from your expr and then do the match? On him.



+1


a source







All Articles