Sha256: 3f82ad416169fdb42eccba89dd797d8fc70202cc35b9981775f6e746e7887d49
Contents?: true
Size: 844 Bytes
Versions: 6
Compression:
Stored size: 844 Bytes
Contents
module Httply module Utilities class Uri class << self def correct_host(host) if !host.to_s.empty? host = host =~ /^http(s)?:\/\//i ? host : "https://#{host}" end return host end 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 def to_path(path) path = path =~ /^http(s)?:\/\// ? URI(path).path : path path = path =~ /^\// ? path : "/#{path}" end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems