Sha256: 057fc99c1202c3c42c5f79ca772b87b126e2092a1801fe0125ce988459481970
Contents?: true
Size: 882 Bytes
Versions: 5
Compression:
Stored size: 882 Bytes
Contents
class Http2::UrlBuilder attr_accessor :host, :port, :protocol, :path, :params def initialize args = {} @params = {} end def build_params url_params = "" if !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
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
http2-0.0.29 | include/url_builder.rb |
http2-0.0.28 | include/url_builder.rb |
http2-0.0.27 | include/url_builder.rb |
http2-0.0.26 | include/url_builder.rb |
http2-0.0.25 | include/url_builder.rb |