Sha256: 5c68b110eb47c5f88cb89088a6770d1ee5ac9fc9d4f2fc2b948a87772c9bd053
Contents?: true
Size: 1.22 KB
Versions: 51
Compression:
Stored size: 1.22 KB
Contents
Addressable::URI.class_eval do def request_uri return nil if self.absolute? && self.scheme !~ /^https?$/ return ( (self.path != "" ? self.path : "/") + (self.query ? "?#{self.query}" : "") ) end def self.normalize_host host host.gsub(/^www\./, "") end def normalized_host host ? host : host.gsub(/^www\./, '') end # Delete 'nil' keys def query_values_with_skip_nil= options to_delete = [] options.each{|k, v| to_delete << k if v.nil?} to_delete.each{|k| options.delete k} self.query_values_without_skip_nil = options end alias_method_chain :query_values=, :skip_nil # Override original to fix: # - extra '?' sign (/some_path?) if there's empty but not-nil query def to_s @uri_string ||= (begin uri_string = "" uri_string << "#{self.scheme}:" if self.scheme != nil uri_string << "//#{self.authority}" if self.authority != nil uri_string << self.path.to_s uri_string << "?#{self.query}" unless self.query.blank? uri_string << "##{self.fragment}" if self.fragment != nil if uri_string.respond_to?(:force_encoding) uri_string.force_encoding(Encoding::UTF_8) end uri_string end) end end
Version data entries
51 entries across 51 versions & 5 rubygems