Sha256: 9c98dfea514413f4ec206474e6a36ee1f18f84903501ba85a73ccf32dd130cd2

Contents?: true

Size: 481 Bytes

Versions: 1

Compression:

Stored size: 481 Bytes

Contents

require 'forwardable'

module Almanack
  class Calendar
    extend Forwardable
    def_delegators :@config, :event_sources, :title

    def initialize(config)
      @config = config
    end

    def events
      from_date = DateTime.now
      to_date = DateTime.now + days_lookahead

      event_sources.map do |event_source|
        event_source.events_between(from_date..to_date)
      end.flatten.sort_by(&:start_date)
    end

    def days_lookahead
      30
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
almanack-0.0.1.alpha3 lib/almanack/calendar.rb