class Almanack::Calendar

Public Class Methods

new(config) click to toggle source
# File lib/almanack/calendar.rb, line 11
def initialize(config)
  @config = config
end

Public Instance Methods

events() click to toggle source
# File lib/almanack/calendar.rb, line 15
def events
  now = Time.now
  future = now + days_lookahead * ONE_DAY
  events_between(now..future)
end
events_between(date_range) click to toggle source
# File lib/almanack/calendar.rb, line 21
def events_between(date_range)
  event_list = event_sources.map do |event_source|
    Thread.new { event_source.events_between(date_range) }
  end.map(&:value).flatten

  event_list.sort_by do |event|
    event.start_time.to_time
  end
end
ical_feed() click to toggle source
# File lib/almanack/calendar.rb, line 31
def ical_feed
  Representation::IcalFeed.from(self).to_s
end
json_feed() click to toggle source
# File lib/almanack/calendar.rb, line 35
def json_feed
  Representation::JSONFeed.from(self).to_s
end