module Url2Event
Constants
- VERSION
Public Class Methods
get_parser_class(uri)
click to toggle source
Returns the appropriate Url2Event
subclass for the given url.
# File lib/url_2_event.rb, line 24 def get_parser_class(uri) parser_class = self::Base.implementations.find { |parser| parser.is_parser_for?(uri) } if parser_class parser_class else raise self::UnsupportedSourceError end end
parse_event_from_uri(uri)
click to toggle source
# File lib/url_2_event.rb, line 15 def parse_event_from_uri(uri) url = parse_url(uri) klass = get_parser_class(url) parser = klass.new(url) parser.get_event end
Private Class Methods
parse_url(uri)
click to toggle source
# File lib/url_2_event.rb, line 38 def parse_url(uri) begin url = URI.parse(uri) rescue raise self::InvalidURLError end if url.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS) url else raise self::InvalidURLError end end