るりまサーチ (Ruby 2.7.0)

最速Rubyリファレンスマニュアル検索!
3件ヒット [1-3件を表示] (0.023秒)
トップページ > バージョン:2.7.0[x] > クエリ:Encoding[x] > クエリ:meta[x] > クエリ:open-uri[x]

別のキーワード

  1. open-uri meta
  2. meta charset
  3. meta base_uri
  4. meta meta
  5. meta status

ライブラリ

モジュール

検索結果

open-uri (114163.0)

http/ftp に簡単にアクセスするためのクラスです。

http/ftp に簡単にアクセスするためのクラスです。

=== 使用例

http/ftp の URL を、普通のファイルのように開けます。

require 'open-uri'
URI.open("http://www.ruby-lang.org/") {|f|
f.each_line {|line| p line}
}

開いたファイルオブジェクトは StringIO もしくは Tempfile で
すが OpenURI::Meta モジュールで拡張されていて、メタ情報を獲得する
メソッドが使えます。

require 'open-uri'
URI.ope...

OpenURI::Meta#meta -> Hash (87358.0)

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

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

//emlist[例][ruby]{
require 'open-uri'
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",
# "tran...

OpenURI::Meta#content_encoding -> [String] (51436.0)

対象となるリソースの Content-Encoding を文字列の配列として返します。 Content-Encoding ヘッダがない場合は、空の配列を返します。

対象となるリソースの Content-Encoding を文字列の配列として返します。
Content-Encoding ヘッダがない場合は、空の配列を返します。

例:

//emlist[例][ruby]{
require 'open-uri'
URI.open('http://example.com/f.tar.gz') {|f|
p f.content_encoding #=> ["x-gzip"]
}
//}