Sha256: 5379db7a1b5a77e5b7d32b939c4ad5c4345d6ff7b97e37841e23ef51c550677a
Contents?: true
Size: 434 Bytes
Versions: 1
Compression:
Stored size: 434 Bytes
Contents
module URI def build(scheme: "http", domain:, path: "/", query: "", fragment: "") if !query.is_a?(String) query = query.to_query # handles non-string argument, a Hash, for example end query = query.present? ? "?#{query.gsub(/\A\?/, "")}" : "" fragment = fragment.present? ? "##{fragment.gsub(/\A\#/, "")}" : "" return "#{scheme}://#{domain}#{path}#{query}#{fragment}" end module_function :build end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
creative_rails_utilities-0.4.4 | lib/creative_rails_utilities/uri.rb |