Sha256: 3267e18fa303e9b6fad0355a7848b575eb0d097873ce0e765ba72a7e8fd4534d
Contents?: true
Size: 1.29 KB
Versions: 6
Compression:
Stored size: 1.29 KB
Contents
# backtick_javascript: true # frozen_string_literal: true module URI def self.decode_www_form(str, enc = undefined, separator: '&', use__charset_: false, isindex: false) raise ArgumentError, "the input of #{name}.#{__method__} must be ASCII only string" unless str.ascii_only? %x{ var ary = [], key, val; if (str.length == 0) return ary; if (enc) #{enc = Encoding.find(enc)}; var parts = str.split(#{separator}); for (var i = 0; i < parts.length; i++) { var string = parts[i]; var splitIndex = string.indexOf('=') if (splitIndex >= 0) { key = string.substr(0, splitIndex); val = string.substr(splitIndex + 1); } else { key = string; val = ''; } if (isindex) { if (splitIndex < 0) { key = ''; val = string; } isindex = false; } key = decodeURIComponent(key.replace(/\+/g, ' ')); if (val) { val = decodeURIComponent(val.replace(/\+/g, ' ')); } else { val = ''; } if (enc) { key = #{`key`.force_encoding(enc)} val = #{`val`.force_encoding(enc)} } ary.push([key, val]); } return ary; } end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
opal-1.8.3.rc1 | stdlib/uri.rb |
opal-1.8.2 | stdlib/uri.rb |
opal-1.8.1 | stdlib/uri.rb |
opal-1.8.0 | stdlib/uri.rb |
opal-1.8.0.beta1 | stdlib/uri.rb |
opal-1.8.0.alpha1 | stdlib/uri.rb |