種類
- インスタンスメソッド (44)
- 文書 (16)
- ライブラリ (11)
ライブラリ
- open-uri (44)
モジュール
-
OpenURI
:: Meta (44)
キーワード
-
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 2
. 7 . 0 (5) - charset (22)
-
content
_ type (11)
検索結果
先頭5件
-
open-uri (44138.0)
-
http/ftp に簡単にアクセスするためのクラスです。 Kernel.#open を再定義します。
...l.#open を再定義します。
=== 使用例
http/ftp の URL を、普通のファイルのように開けます。
require 'open-uri'
open("http://www.ruby-lang.org/") {|f|
f.each_line {|line| p line}
}
開いたファイルオブジェクトは StringIO もしくは Tempfile で......使えます。
require 'open-uri'
open("http://www.ruby-lang.org/en") {|f|
f.each_line {|line| p line}
p f.base_uri # <URI::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 #......追加のヘッダフィールドを指定できます。
require 'open-uri'
open("http://www.ruby-lang.org/en/",
"User-Agent" => "Ruby/#{RUBY_VERSION}",
"From" => "foo@bar.invalid",
"Referer" => "http://www.ruby-lang.org/") {|f|
...
}
http_proxy や ftp_proxy などの環境......るためのクラスです。
=== 使用例
http/ftp の URL を、普通のファイルのように開けます。
require 'open-uri'
URI.open("http://www.ruby-lang.org/") {|f|
f.each_line {|line| p line}
}
開いたファイルオブジェクトは StringIO もしくは Tempfile で......えます。
require 'open-uri'
URI.open("http://www.ruby-lang.org/en") {|f|
f.each_line {|line| p line}
p f.base_uri # <URI::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......加のヘッダフィールドを指定できます。
require 'open-uri'
URI.open("http://www.ruby-lang.org/en/",
"User-Agent" => "Ruby/#{RUBY_VERSION}",
"From" => "foo@bar.invalid",
"Referer" => "http://www.ruby-lang.org/") {|f|
...
}
http_proxy や ftp_proxy などの環... -
OpenURI
:: Meta # content _ type -> String (8188.0) -
対象となるリソースの Content-Type を文字列で返します。Content-Type ヘッダの情報が使われます。 Content-Type ヘッダがない場合は、"application/octet-stream" を返します。
...Content-Type を文字列で返します。Content-Type ヘッダの情報が使われます。
Content-Type ヘッダがない場合は、"application/octet-stream" を返します。
//emlist[例][ruby]{
require 'open-uri'
open('http://www.ruby-lang.org/') {|f|
p f.content_type #=> "text/html"......ntent-Type を文字列で返します。Content-Type ヘッダの情報が使われます。
Content-Type ヘッダがない場合は、"application/octet-stream" を返します。
//emlist[例][ruby]{
require 'open-uri'
URI.open('http://www.ruby-lang.org/') {|f|
p f.content_type #=> "text/htm... -
OpenURI
:: Meta # charset -> String | nil (8176.0) -
対象となるリソースの文字コードを文字列で返します。Content-Type ヘッダの文字コード情報が使われます。 文字列は小文字へと変換されています。
...対象となるリソースの文字コードを文字列で返します。Content-Type ヘッダの文字コード情報が使われます。
文字列は小文字へと変換されています。
Content-Type ヘッダがない場合は、nil を返します。ただし、ブロックが与え......身のタイプが text である場合は、
2616 3.7.1 で定められているとおり、文字列 "iso-8859-1" を返します。
//emlist[例][ruby]{
require 'open-uri'
open("http://www.ruby-lang.org/en") {|f|
p f.content_type # => "text/html"
p f.charset # => "iso-8859-1"
}
//}......のタイプが text である場合は、
2616 3.7.1 で定められているとおり、文字列 "iso-8859-1" を返します。
//emlist[例][ruby]{
require 'open-uri'
URI.open("http://www.ruby-lang.org/en") {|f|
p f.content_type # => "text/html"
p f.charset # => "iso-8859-1"
}
//}... -
OpenURI
:: Meta # charset { . . . } -> String (8176.0) -
対象となるリソースの文字コードを文字列で返します。Content-Type ヘッダの文字コード情報が使われます。 文字列は小文字へと変換されています。
...対象となるリソースの文字コードを文字列で返します。Content-Type ヘッダの文字コード情報が使われます。
文字列は小文字へと変換されています。
Content-Type ヘッダがない場合は、nil を返します。ただし、ブロックが与え......身のタイプが text である場合は、
2616 3.7.1 で定められているとおり、文字列 "iso-8859-1" を返します。
//emlist[例][ruby]{
require 'open-uri'
open("http://www.ruby-lang.org/en") {|f|
p f.content_type # => "text/html"
p f.charset # => "iso-8859-1"
}
//}......のタイプが text である場合は、
2616 3.7.1 で定められているとおり、文字列 "iso-8859-1" を返します。
//emlist[例][ruby]{
require 'open-uri'
URI.open("http://www.ruby-lang.org/en") {|f|
p f.content_type # => "text/html"
p f.charset # => "iso-8859-1"
}
//}... -
OpenURI
:: Meta # meta -> Hash (8136.0) -
ヘッダを収録したハッシュを返します。
...st[例][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"}
}......[例][ruby]{
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"}... -
NEWS for Ruby 2
. 7 . 0 (360.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...は参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリストは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。
== 2.6.0 以降の変更
=== 言語仕様の変更
==== パターンマッチ
* パターンマ......15594
* open-uri
* Kernelモジュールでopen-uriのopenメソッドを使うと警告されるようになりました。
代わりにURI.openを使ってください。 15893
* メディアタイプ "text/*" のデフォルトの charset が ISO-8859-1 から UTF-8 に......tionParser.new do |opts|
opts.on("-f", "--foo", "foo") {|v| }
opts.on("-b", "--bar", "bar") {|v| }
opts.on("-c", "--baz", "baz") {|v| }
end.parse!
//}
//emlist{
$ ruby test.rb --baa
Traceback (most recent call last):
test.rb:7:in `<main>': invalid option: --baa (OptionParser::InvalidOption)
D... -
NEWS for Ruby 2
. 1 . 0 (102.0) -
NEWS for Ruby 2.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...は参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリストは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。
== 2.0.0 以降の変更
=== 言語仕様の変更
* キーワード引数のデフォルト値......張: OpenSSL::BN.new Fixnum や Bignum を引数として取れるようになりました。
* open-uri
* 複数フィールドに同じ名前を使うことをサポートしました (Set-Cookieのように)
* Pathname
* 追加: Pathname#write
* 追加: Pathname#binwrite
* ra......* REXML::Parsers::StreamParser
* entityイベントをサポート
* REXML::Text
* REXML::Text#<< 'text << "XXX" << "YYY"' のようなメソッドチェインをサポート
* REXML::Text#<< "raw" でないモードをサポート
* rinda
* Rinda::RingServer, Rinda::R...