class Slotty::Slot

Attributes

begin[R]
end[R]
range[R]

Public Class Methods

new(range:) click to toggle source
# File lib/slotty/slot.rb, line 7
def initialize(range:)
  @range = range
  @begin = range.begin
  @end = range.end
end

Public Instance Methods

full() click to toggle source
# File lib/slotty/slot.rb, line 25
def full
  {
    start_time: range.begin,
    end_time:   range.end,
    time:       to_s
  }
end
has_overlaps?(excluded_slots = []) click to toggle source
# File lib/slotty/slot.rb, line 13
def has_overlaps?(excluded_slots = [])
  return false if excluded_slots.empty?

  excluded_slots.any? do |exc_slot|
    Timeframe.contains?(exc_slot, range)
  end
end
to_s() click to toggle source
# File lib/slotty/slot.rb, line 21
def to_s
  range.begin.strftime('%I:%M %p')
end