Sha256: 7fcb4aee58d52dd195ee24d498a45a5815ff5eb40ef319b1d09e3687dc7e6c27

Contents?: true

Size: 595 Bytes

Versions: 1

Compression:

Stored size: 595 Bytes

Contents

module Slotty
  class Timeframe
    class << self
      def covers?(surrounding_range, included_range)
        starts_before = surrounding_range.begin <= included_range.begin
        ends_after = surrounding_range.end >= included_range.end

        starts_before && ends_after
      end

      def contains?(excluder, potential_slot)
        start_within = potential_slot.begin >= excluder.begin && potential_slot.begin < excluder.end
        end_within = potential_slot.end > excluder.begin && potential_slot.end <= excluder.end

        start_within || end_within
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slotty-1.0.0 lib/slotty/timeframe.rb