るりまサーチ (Ruby 2.1.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.072秒)

別のキーワード

  1. rake sh
  2. fileutils sh
  3. _builtin lock_sh
  4. constants lock_sh
  5. sync sh

ライブラリ

キーワード

検索結果

Net::HTTPHeader#fetch(key) {|hash| .... } -> String (307.0)

key ヘッダフィールドを返します。

...q.fetch("content-length", "default") # => "default"
//}

//emlist[例 key とブロックを指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length") { |e| 99 } # => 99
//}

@see Net::HTTPHeader#[]...

Net::HTTPHeader#type_params -> Hash (307.0)

Content-Type のパラメータを {"charset" => "iso-2022-jp"} という形の Hash で返します。

Content-Type のパラメータを {"charset" => "iso-2022-jp"}
という形の Hash で返します。

Content-Type: ヘッダフィールドが存在しない場合には
空のハッシュを返します。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_response(uri)
res.type_params # => {"charset"=>"UTF-8"}
//}