class TimeFrame::CoveredFrame

Getting the covering time frame from a bunch of time_frame's.

Public Class Methods

new(time_frames) click to toggle source
# File lib/time_frame/time_frame_covered.rb, line 5
def initialize(time_frames)
  @time_frames = time_frames.reject(&:empty?)
end

Public Instance Methods

frame() click to toggle source
# File lib/time_frame/time_frame_covered.rb, line 9
def frame
  return EMPTY unless @time_frames.any?
  min = @time_frames.min_by(&:min).min
  max = @time_frames.max_by(&:max).max
  TimeFrame.new(min: min, max: max)
end