Sha256: 0284ef6a4408d44a06a495cdaff9dbf57e3e6d14fc2645d31b32f459412fe997
Contents?: true
Size: 885 Bytes
Versions: 2
Compression:
Stored size: 885 Bytes
Contents
class Http2::UrlBuilder attr_accessor :host, :port, :protocol, :path, :params def initialize args = {} @params = {} end def build_params url_params = "" unless params.empty? first = true params.each do |key, val| if first first = false else url_params << "&" end url_params << Http2::Utils.urlenc(key) url_params << "=" url_params << Http2::Utils.urlenc(val) end end return url_params end def build_path_and_params url = "#{path}" if params? url << "?" url << build_params end return url end def build url = "" url << "#{protocol}://" if protocol if host url << host url << ":#{port}/" if port end url << build_path_and_params return url end def params? @params.any? end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
http2-0.0.31 | include/url_builder.rb |
http2-0.0.30 | include/url_builder.rb |