Sha256: 929a54c562397e21252578ef47aa3d7ecb81474ee63286f4e4dd35caedff5c22

Contents?: true

Size: 517 Bytes

Versions: 1

Compression:

Stored size: 517 Bytes

Contents

# 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::DEFAULT_PARSER.make_regexp)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-ical-tag-1.6.0 lib/jekyll-ical-tag/calendar_fetcher.rb