Class: NOTAM::Schedule::ScheduleArray Abstract

Inherits:
Array
  • Object
show all
Defined in:
lib/notam/schedule.rb

Overview

This class is abstract.

Direct Known Subclasses

Dates, Days, Times

Instance Method Summary collapse

Instance Method Details

#cover?(object) ⇒ Boolean

Whether the given object is covered by this schedule array

Parameters:

  • object (AIXM::Schedule::Date, AIXM::Schedule::Day, AIXM::Schedule::Time)

Returns:

  • (Boolean)


306
307
308
# File 'lib/notam/schedule.rb', line 306

def cover?(object)
  any? { object.covered_by? _1 }
end

#inspectString

Returns:

  • (String)


292
293
294
# File 'lib/notam/schedule.rb', line 292

def inspect
  %Q(#<#{self.class} #{to_s}>)
end

#nextScheduleArray

Step through all elements and shift all dates or days to the next day

Returns:



313
314
315
316
317
318
319
320
321
# File 'lib/notam/schedule.rb', line 313

def next
  entries.map do |entry|
    if entry.instance_of? Range
      (entry.first.next..entry.last.next)
    else
      entry.next
    end
  end.then { self.class.new(_1) }
end

#to_sString

Returns:

  • (String)


297
298
299
# File 'lib/notam/schedule.rb', line 297

def to_s
  '[' + entries.map { _1.to_s }.join(', ') + ']'
end