Sha256: 947aec9c0997979adcd883375abbf5e60fef0819121805e4ad1306ece04821af

Contents?: true

Size: 515 Bytes

Versions: 9

Compression:

Stored size: 515 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true

require "cgi"
require "api_cache"

module Jekyll
  class IcalTag
    class CalendarFetcher
      def initialize(url)
        @url = CGI.unescape(url)

        raise "No URL provided or in innapropriate form '#{url}'" unless is_valid_url?
      end

      def fetch
        puts "Fetching #{url}"
        @fetch ||= APICache.get(url)
      end

      private

      attr_reader :url

      def is_valid_url?
        !!(url =~ URI::regexp)
      end
    end
  end
end

Version data entries

9 entries across 8 versions & 1 rubygems

Version Path
jekyll-ical-tag-1.5.1 lib/jekyll-ical-tag/calendar_fetcher.rb
jekyll-ical-tag-1.5 lib/jekyll-ical-tag/calendar_fetcher.rb
jekyll-ical-tag-1.4.0 _site/lib/jekyll-ical-tag/calendar_fetcher.rb
jekyll-ical-tag-1.4.0 lib/jekyll-ical-tag/calendar_fetcher.rb
jekyll-ical-tag-1.3.3 lib/jekyll-ical-tag/calendar_fetcher.rb
jekyll-ical-tag-1.3.2 lib/jekyll-ical-tag/calendar_fetcher.rb
jekyll-ical-tag-1.3.1 lib/jekyll-ical-tag/calendar_fetcher.rb
jekyll-ical-tag-1.3 lib/jekyll-ical-tag/calendar_fetcher.rb
jekyll-ical-tag-1.2.5 lib/jekyll-ical-tag/calendar_fetcher.rb