Skip to content

Commit

Permalink
Merge pull request #2884 from iwtn/fix_uri_decode_www_form_samplecode
Browse files Browse the repository at this point in the history
fix: URI.decode_www_formのサンプルコードでrassocがエラーを出していたので修正
  • Loading branch information
znz authored Nov 2, 2024
2 parents 6d7acd9 + 5e68c4e commit 778f0e2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions refm/api/src/uri/URI
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,10 @@ enc で指定したエンコーディングの文字列が URL エンコード

require 'uri'
ary = URI.decode_www_form("a=1&a=2&b=3")
p ary #=> [['a', '1'], ['a', '2'], ['b', '3']]
p ary.assoc('a').last #=> '1'
p ary.assoc('b').last #=> '3'
p ary.rassoc('a').last #=> '2'
p Hash[ary] # => {"a"=>"2", "b"=>"3"}
p ary #=> [['a', '1'], ['a', '2'], ['b', '3']]
p ary.assoc('a').last #=> '1'
p ary.assoc('b').last #=> '3'
p Hash[ary] #=> {"a"=>"2", "b"=>"3"}

@param str デコード対象の文字列
@param enc エンコーディング
Expand Down

0 comments on commit 778f0e2

Please sign in to comment.