class Httply::Utilities::Uri
Public Class Methods
correct_host(host)
click to toggle source
# File lib/httply/utilities/uri.rb, line 6 def correct_host(host) if !host.to_s.empty? host = host =~ /^http(s)?:\/\//i ? host : "https://#{host}" end return host end
parse_host(url)
click to toggle source
# File lib/httply/utilities/uri.rb, line 14 def parse_host(url) host = nil if host.to_s.empty? && url =~ /^http(s)?:\/\// uri = URI(url) host = "#{uri.scheme}://#{uri.host}" end return host end
to_path(path)
click to toggle source
# File lib/httply/utilities/uri.rb, line 25 def to_path(path) path = path =~ /^http(s)?:\/\// ? URI(path).path : path path = path =~ /^\// ? path : "/#{path}" end