Class: NOTAM::Schedule::Dates

Inherits:
ScheduleArray show all
Defined in:
lib/notam/schedule.rb

Instance Method Summary collapse

Methods inherited from ScheduleArray

#cover?, #inspect, #next, #to_s

Instance Method Details

#clusterAIXM::Schedule::Dates

Convert subsequent entries to ranges

Returns:

  • (AIXM::Schedule::Dates)


328
329
330
331
332
333
334
# File 'lib/notam/schedule.rb', line 328

def cluster
  self.class.new(
    entries
      .slice_when { _1.next != _2 }
      .map { _1.count > 1 ? (_1.first.._1.last) : _1.first }
  )
end