Top Level Namespace

Includes:
FeedParserUtilities, OpenURI

Defined Under Namespace

Modules: FeedParser, FeedParserMixin, FeedParserUtilities, Hpricot, XChar, XML Classes: BetterSGMLParser, BetterSGMLParserError, Fixnum, ForgivingURI, PprintSerializer, Serializer, String, TextSerializer

Constant Summary

Constants included from FeedParserUtilities

FeedParserUtilities::Encoding_Aliases

Instance Method Summary collapse

Methods included from FeedParserUtilities

SanitizerDoc, #_ebcdic_to_ascii, #getCharacterEncoding, #index_match, #py2rtime, #resolveRelativeURIs, #sanitizeHTML, #stripDoctype, #toUTF8, #uconvert, #unicode

Instance Method Details

#urljoin(base, uri) ⇒ Object



940
941
942
943
944
945
946
947
948
949
950
# File 'lib/rfeedparser/forgiving_uri.rb', line 940

def urljoin(base, uri)
  urifixer = /^([A-Za-z][A-Za-z0-9+-.]*:\/\/)(\/*)(.*?)/u
  uri = uri.sub(urifixer, '\1\3') 
  begin
    return ForgivingURI.join(base, uri).to_s 
  rescue URI::BadURIError => e
    if ForgivingURI.parse(base).relative? 
      return ForgivingURI.parse(uri).to_s
    end
  end
end