Class: URI::HTTP
Class Method Summary collapse
Class Method Details
.to_option(spec) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/appkernel/types.rb', line 29 def self.to_option(spec) uri = URI.parse(spec) case uri.scheme when "http" then uri when nil then to_option("http://#{spec}") else if uri.host.nil? to_option("http://#{spec}") else raise "#{spec.inspect} is not a valid http url" end end end |