Class: URI::Generic
Instance Method Summary collapse
Instance Method Details
#absolute(host, scheme = nil) ⇒ Object
63 64 65 66 67 |
# 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? ⇒ Boolean
59 60 61 |
# File 'lib/socializer/scraper/extensions.rb', line 59 def mail? scheme == "mailto" end |
#url? ⇒ Boolean
55 56 57 |
# File 'lib/socializer/scraper/extensions.rb', line 55 def url? %w[ http https ].include?(scheme) end |