Module: URI

Defined in:
lib/hub/speedy_stdlib.rb

Defined Under Namespace

Classes: HTTP

Constant Summary collapse

InvalidURIError =
Class.new(StandardError)

Class Method Summary collapse

Class Method Details

.===(other) ⇒ Object



53
54
55
# File 'lib/hub/speedy_stdlib.rb', line 53

def self.===(other)
  other.respond_to?(:host)
end

.encode_www_form(params) ⇒ Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/hub/speedy_stdlib.rb', line 42

def self.encode_www_form(params)
  params.map { |k, v|
    if v.class == Array
      encode_www_form(v.map { |x| [k, x] })
    else
      ek = CGI.escape(k)
      v.nil? ? ek : "#{ek}=#{CGI.escape(v)}"
    end
  }.join("&")
end

.parse(str) ⇒ Object



38
39
40
# File 'lib/hub/speedy_stdlib.rb', line 38

def self.parse(str)
  URI::HTTP.new(str)
end