Skip to content

Commit

Permalink
URI.decode_www_formのサンプルコードでrassocがエラーを出していたので修正
Browse files Browse the repository at this point in the history
  • Loading branch information
iwtn committed May 18, 2024
1 parent 58b73ef commit 714c9ee
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions refm/api/src/uri/URI
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ 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 ary.rassoc('2').first #=> 'a'
p Hash[ary] # => {"a"=>"2", "b"=>"3"}

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

0 comments on commit 714c9ee

Please sign in to comment.