Ruby 2.2.0 リファレンスマニュアル > ライブラリ一覧 > open-uriライブラリ > OpenURI::Metaモジュール > meta

instance method OpenURI::Meta#meta

meta -> Hash[permalink][rdoc]

ヘッダを収録したハッシュを返します。



require 'open-uri'
open('http://example.com/') {|f|
  p f.meta
  #=> {"date"=>"Sun, 04 May 2008 11:26:40 GMT",
  #    "content-type"=>"text/html;charset=utf-8",
  #    "server"=>"Apache/2.0.54 (Debian GNU/Linux) mod_ssl/2.0.54 OpenSSL/0.9.7e",
  #    "transfer-encoding"=>"chunked"}
}