Sha256: cc5ec06c2e9655d217b80b0cc9a49ea1dd4655b622bd49b220f42b385810cdd7

Contents?: true

Size: 749 Bytes

Versions: 2

Compression:

Stored size: 749 Bytes

Contents

# frozen_string_literal: true
require_relative '../calendar'

module TimeBoss
  module Calendars
    class Broadcast < Calendar
      def initialize
        super(basis: Basis)
      end

      def supports_weeks?
        true
      end

      private

      class Basis < Calendar::Support::MonthBasis
        def start_date
          @_start_date ||= begin
                             date = Date.civil(year, month, 1)
                             date - (date.wday + 6) % 7
                           end
        end

        def end_date
          @_end_date ||= begin
                           date = Date.civil(year, month, -1)
                           date - date.wday
                         end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
timeboss-0.2.1 lib/timeboss/calendars/broadcast.rb
timeboss-0.2.0 lib/timeboss/calendars/broadcast.rb