Sha256: ecc45568a1f6141a1f1cd98e33164d0747105bafe40a03dfa593920868bc838c

Contents?: true

Size: 679 Bytes

Versions: 4

Compression:

Stored size: 679 Bytes

Contents

# frozen_string_literal: true
require_relative './support/unit'

module TimeBoss
  class Calendar
    class Day < Support::Unit
      def initialize(calendar, start_date)
        super(calendar, start_date, start_date)
      end

      def name
        start_date.to_s
      end

      def title
        start_date.strftime('%B %-d, %Y')
      end

      def to_s
        name
      end

      def index
        @_index ||= (start_date - calendar.year_for(start_date).start_date).to_i + 1
      end

      def previous
        self.class.new(calendar, start_date - 1.day)
      end

      def next
        self.class.new(calendar, start_date + 1.day)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
timeboss-0.0.8 lib/timeboss/calendar/day.rb
timeboss-0.0.7 lib/timeboss/calendar/day.rb
timeboss-0.0.6 lib/timeboss/calendar/day.rb
timeboss-0.0.5 lib/timeboss/calendar/day.rb