class URI::Generic

Public Instance Methods

absolute(host, scheme = nil) click to toggle source
# File lib/socializer/scraper/extensions.rb, line 63
def absolute(host, scheme = nil)
  return self unless self.scheme.nil?
  path = to_s.start_with?("/") ? to_s : "/#{to_s}"
  URI.parse("#{scheme.blank? ? "http" : scheme}://#{host}#{path}")
end
mail?() click to toggle source
# File lib/socializer/scraper/extensions.rb, line 59
def mail?
  scheme == "mailto"
end
url?() click to toggle source
# File lib/socializer/scraper/extensions.rb, line 55
def url?
  %w[ http https ].include?(scheme)
end