44件ヒット
[1-44件を表示]
(0.043秒)
種類
- インスタンスメソッド (22)
- ライブラリ (11)
- 文書 (11)
ライブラリ
- open-uri (22)
モジュール
-
OpenURI
:: Meta (22)
キーワード
-
content
_ encoding (11) - open-uri (11)
- 正規表現 (11)
検索結果
-
OpenURI
:: Meta # meta -> Hash (21113.0) -
ヘッダを収録したハッシュを返します。
...][ruby]{
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"}
}
//}......uby]{
require 'open-uri'
URL.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"}
}
//}... -
OpenURI
:: Meta # content _ encoding -> [String] (9139.0) -
対象となるリソースの Content-Encoding を文字列の配列として返します。 Content-Encoding ヘッダがない場合は、空の配列を返します。
...となるリソースの Content-Encoding を文字列の配列として返します。
Content-Encoding ヘッダがない場合は、空の配列を返します。
例:
//emlist[例][ruby]{
require 'open-uri'
open('http://example.com/f.tar.gz') {|f|
p f.content_encoding #=> ["x-gzip"]
}
//}......るリソースの Content-Encoding を文字列の配列として返します。
Content-Encoding ヘッダがない場合は、空の配列を返します。
例:
//emlist[例][ruby]{
require 'open-uri'
URI.open('http://example.com/f.tar.gz') {|f|
p f.content_encoding #=> ["x-gzip"]
}
//}... -
正規表現 (118.0)
-
正規表現 * metachar * expansion * char * anychar * string * str * quantifier * capture * grouping * subexp * selector * anchor * cond * option * encoding * comment * free_format_mode * absenceop * list * specialvar * references
...正規表現
* metachar
* expansion
* char
* anychar
* string
* str
* quantifier
* capture
* grouping
* subexp
* selector
* anchor
* cond
* option
* encoding
* comment
* free_format_mode
* absenceop
* list
* specialvar
* references
正規表現(regular ex......===[a:metachar] メタ文字列とリテラル、メタ文字とエスケープ
正規表現の文法には、正規表現内で特別な働きをする文字列と、それ以外の
その文字列そのものにマッチするような文字列があります。
前者をメタ文字列(meta strin......ては、「京都」「大阪」「神戸」がリテラルで、
2つの「|」がメタ文字列です。
以下の文字は「メタ文字」(meta character)
と呼ばれる、正規表現内で特殊な働きをする文字です。
( ) [ ] { } . ? + * | \
これらの文字をリテラル... -
open-uri (18.0)
-
http/ftp に簡単にアクセスするためのクラスです。
...lang.org/") {|f|
f.each_line {|line| p line}
}
開いたファイルオブジェクトは StringIO もしくは Tempfile で
すが OpenURI::Meta モジュールで拡張されていて、メタ情報を獲得する
メソッドが使えます。
require 'open-uri'
open("http://www.ruby-......::HTTP:0x40e6ef2 URL:http://www.ruby-lang.org/en/>
p f.content_type # "text/html"
p f.charset # "iso-8859-1"
p f.content_encoding # []
p f.last_modified # Thu Dec 05 02:45:02 UTC 2002
}
ハッシュ引数で、追加のヘッダフィールドを指定できます......方法で開けます。
require 'open-uri'
uri = URI.parse("http://www.ruby-lang.org/en/")
uri.open {|f|
...
}
URI オブジェクトは直接読み込むことができます。
戻り値の文字列は、OpenURI::Meta で拡張されています。
str = uri.read
p str.base_uri......lang.org/") {|f|
f.each_line {|line| p line}
}
開いたファイルオブジェクトは StringIO もしくは Tempfile で
すが OpenURI::Meta モジュールで拡張されていて、メタ情報を獲得する
メソッドが使えます。
require 'open-uri'
URI.open("http://www.r...