Method: NOTAM::Schedule#slice

Defined in:
lib/notam/schedule.rb

#slice(from, to = nil) ⇒ NOTAM::Schedule

Note:

#inactives of sub-schedules are always empty which guarantees they can be translated to AIXM or OFMX.

Extract a sub-schedule for the given time window.

Parameters:

  • from (AIXM::Schedule::Date)

    beginning date

  • to (AIXM::Schedule::Date) (defaults to: nil)

    end date (defaults to from)

Returns:



239
240
241
242
243
244
245
# File 'lib/notam/schedule.rb', line 239

def slice(from, to=nil)
  sliced_actives = Dates.new
  (from..(to || from)).each do |date|
    sliced_actives << date if actives.cover?(date) && !inactives.cover?(date)
  end
  self.class.send(:new, sliced_actives.cluster, times, Days.new, base_date: @base_date)
end