Sha256: 94aa8b4b8e5f432e9938aeb866ae6c0be4792123728bfd76a06740fb21fdf6d4

Contents?: true

Size: 698 Bytes

Versions: 39

Compression:

Stored size: 698 Bytes

Contents

# frozen_string_literal: true

require "uri"
if RUBY_VERSION < "2.6.0"
  require "active_support/core_ext/module/redefine_method"
  URI::Parser.class_eval do
    silence_redefinition_of_method :unescape
    def unescape(str, escaped = /%[a-fA-F\d]{2}/)
      # TODO: Are we actually sure that ASCII == UTF-8?
      # YK: My initial experiments say yes, but let's be sure please
      enc = str.encoding
      enc = Encoding::UTF_8 if enc == Encoding::US_ASCII
      str.dup.force_encoding(Encoding::ASCII_8BIT).gsub(escaped) { |match| [match[1, 2].hex].pack("C") }.force_encoding(enc)
    end
  end
end

module URI
  class << self
    def parser
      @parser ||= URI::Parser.new
    end
  end
end

Version data entries

39 entries across 39 versions & 6 rubygems

Version Path
activesupport-5.2.8.1 lib/active_support/core_ext/uri.rb
activesupport-5.2.8 lib/active_support/core_ext/uri.rb
activesupport-5.2.7.1 lib/active_support/core_ext/uri.rb
activesupport-5.2.7 lib/active_support/core_ext/uri.rb
activesupport-5.2.6.3 lib/active_support/core_ext/uri.rb
activesupport-5.2.6.2 lib/active_support/core_ext/uri.rb
activesupport-5.2.6.1 lib/active_support/core_ext/uri.rb
activesupport-5.2.6 lib/active_support/core_ext/uri.rb
activesupport-5.2.4.6 lib/active_support/core_ext/uri.rb
activesupport-5.2.5 lib/active_support/core_ext/uri.rb
activesupport-5.2.4.5 lib/active_support/core_ext/uri.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.1/lib/active_support/core_ext/uri.rb
activesupport-5.2.4.4 lib/active_support/core_ext/uri.rb
activesupport-5.2.4.3 lib/active_support/core_ext/uri.rb
activesupport-5.2.4.2 lib/active_support/core_ext/uri.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.4.1/lib/active_support/core_ext/uri.rb
activesupport-5.2.4.1 lib/active_support/core_ext/uri.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/uri.rb
activesupport-5.2.4 lib/active_support/core_ext/uri.rb
activesupport-5.2.4.rc1 lib/active_support/core_ext/uri.rb