module FeedNormalizer::RewriteRelativeLinks
Public Instance Methods
rewrite_relative_links(text, url)
click to toggle source
# File lib/structures.rb, line 136 def rewrite_relative_links(text, url) if host = url_host(url) text.to_s.gsub(/(href|src)=('|")\//, '\1=\2http://' + host + '/') else text end end
Private Instance Methods
url_host(url)
click to toggle source
# File lib/structures.rb, line 145 def url_host(url) URI.parse(url).host rescue nil end