Sha256: 3f77c1b3bc60081df2f492c6a6ee38b3c374f30c795907785acbbce4cb6f37a3

Contents?: true

Size: 592 Bytes

Versions: 13

Compression:

Stored size: 592 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true

require "api_cache"
require "active_support"
require "icalendar"

module Jekyll
  class IcalTag
    class CalendarParser
      def initialize(url)
        @url = URI.unescape(url)
      end

      def events
        @events ||= begin
          Icalendar::Event.parse(ics_feed)
                          .sort { |e1, e2| e1.dtstart <=> e2.dtstart }
                          .map { |e| Jekyll::IcalTag::Event.new(e) }
        end
      end

      private

      def ics_feed
        @ics_feed ||= APICache.get(@url)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
jekyll-ical-tag-1.2.4 lib/jekyll-ical-tag/calendar_parser.rb
jekyll-ical-tag-1.2.3 lib/jekyll-ical-tag/calendar_parser.rb
jekyll-ical-tag-1.2.2 lib/jekyll-ical-tag/calendar_parser.rb
jekyll-ical-tag-1.2.1 lib/jekyll-ical-tag/calendar_parser.rb
jekyll-ical-tag-1.2.0 lib/jekyll-ical-tag/calendar_parser.rb
jekyll-ical-tag-1.1.0 lib/jekyll-ical-tag/calendar_parser.rb
jekyll-ical-tag-1.0.9 lib/jekyll-ical-tag/calendar_parser.rb
jekyll-ical-tag-1.0.8 lib/jekyll-ical-tag/calendar_parser.rb
jekyll-ical-tag-1.0.7 lib/jekyll-ical-tag/calendar_parser.rb
jekyll-ical-tag-1.0.6 lib/jekyll-ical-tag/calendar_parser.rb
jekyll-ical-tag-1.0.5 lib/jekyll-ical-tag/calendar_parser.rb
jekyll-ical-tag-1.0.4 lib/jekyll-ical-tag/calendar_parser.rb
jekyll-ical-tag-1.0.3 lib/jekyll-ical-tag/calendar_parser.rb