るりまサーチ

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

別のキーワード

  1. kernel require
  2. getoptlong require_order
  3. rubygems/custom_require require
  4. irb/ext/use-loader irb_require
  5. rdoc/require require

モジュール

キーワード

検索結果

<< 1 2 > >>

Net::HTTPHeader#content_type -> String|nil (15457.0)

"text/html" のような Content-Type を表す 文字列を返します。

..."text/html" のような Content-Type を表す
文字列を返します。

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

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

uri = URI.parse('http://www.example.com/comments.cgi?post=comment')
r
eq = Net::HTTP::Post...
....new(uri.request_uri)
r
eq.content_type # => nil
r
eq.content_type = 'multipart/form-data'
r
eq.content_type # => "multipart/form-data"
//}...

Net::HTTPHeader#fetch(key) -> String (9390.0)

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

...ルドを返します。

たとえばキー 'content-length' に対しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。

該当するキーが登録されてい
ない時には、引数 default が与えられていればその値を、...
...aram key ヘッダフィール名を文字列で与えます。
@param default 該当するキーが登録されていない時の返り値を指定します。
@raise IndexError 引数defaultもブロックも与えられてない時、キーの探索に 失敗すると発生します。

//emlist[...
...する][ruby]{
require
'net/http'

uri = URI.parse('http://www.example.com/index.html')
r
eq = Net::HTTP::Get.new(uri.request_uri)
r
eq.fetch("user-agent") # => "Ruby"
//}

//emlist[例 key のみ指定。key が存在しない][ruby]{
require
'net/http'

begin
r
eq.fetch("content-length")
r
escue =>...

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

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

...ルドを返します。

たとえばキー 'content-length' に対しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。

該当するキーが登録されてい
ない時には、引数 default が与えられていればその値を、...
...aram key ヘッダフィール名を文字列で与えます。
@param default 該当するキーが登録されていない時の返り値を指定します。
@raise IndexError 引数defaultもブロックも与えられてない時、キーの探索に 失敗すると発生します。

//emlist[...
...する][ruby]{
require
'net/http'

uri = URI.parse('http://www.example.com/index.html')
r
eq = Net::HTTP::Get.new(uri.request_uri)
r
eq.fetch("user-agent") # => "Ruby"
//}

//emlist[例 key のみ指定。key が存在しない][ruby]{
require
'net/http'

begin
r
eq.fetch("content-length")
r
escue =>...

Net::HTTPHeader#fetch(key, default) -> String (9390.0)

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

...ルドを返します。

たとえばキー 'content-length' に対しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。

該当するキーが登録されてい
ない時には、引数 default が与えられていればその値を、...
...aram key ヘッダフィール名を文字列で与えます。
@param default 該当するキーが登録されていない時の返り値を指定します。
@raise IndexError 引数defaultもブロックも与えられてない時、キーの探索に 失敗すると発生します。

//emlist[...
...する][ruby]{
require
'net/http'

uri = URI.parse('http://www.example.com/index.html')
r
eq = Net::HTTP::Get.new(uri.request_uri)
r
eq.fetch("user-agent") # => "Ruby"
//}

//emlist[例 key のみ指定。key が存在しない][ruby]{
require
'net/http'

begin
r
eq.fetch("content-length")
r
escue =>...

Net::HTTPHeader#delete(key) -> [String] | nil (9340.0)

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

...aram key 削除するフィールド名
@return 取り除かれたフィールドの値を返します。
key ヘッダフィールドが存在しなかった場合には
nil を返します。

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

uri = URI.parse('http://www.example.com/index.ht...
...ml')
r
eq = Net::HTTP::Get.new(uri.request_uri)
r
eq.content_length = 10
r
eq.content_length # => 10
r
eq.delete("Content-Length") # => ["10"]
r
eq.content_length # => nil
//}...

絞り込み条件を変える

Net::HTTPHeader#get_fields(key) -> [String] (9322.0)

key ヘッダフィールドの値 (文字列) を配列で返します。

...たとえばキー 'content-length' に対しては ['2048'] のような
文字列が得られます。一種類のヘッダフィールドが一つのヘッダの中
に複数存在することがありえます。
key は大文字小文字を区別しません。

@param key ヘッダフィー...
...ル名を文字列で与えます。

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

uri = URI.parse('http://www.example.com/index.html')
r
es = Net::HTTP.get_response(uri)
r
es.get_fields('accept-ranges') # => ["none"]
//}

@see Net::HTTPHeader#[] , Net::HTTPHeader#[]=,
Net::HTTPHeader#add_field...

Net::HTTPHeader#main_type -> String|nil (9322.0)

"text/html" における "text" のようなタイプを表す 文字列を返します。

..."text/html" における "text" のようなタイプを表す
文字列を返します。

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

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

uri = URI.parse('http://www.example.com/index.html')
r
es = Net::HTTP.get_r...
...esponse(uri)
r
es.main_type # => "text"
//}...

Net::HTTPHeader#sub_type -> String|nil (9322.0)

"text/html" における "html" のようなサブタイプを表す 文字列を返します。

..."text/html" における "html" のようなサブタイプを表す
文字列を返します。

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

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

uri = URI.parse('http://www.example.com/index.html')
r
es = Net::HTTP...
....get_response(uri)
r
es.sub_type # => "html"
//}...

Net::HTTPHeader#[](key) -> String|nil (6328.0)

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

...content-length' に対しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。

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

uri = URI.parse('http://www.example.com/index.html')
r
eq = Net::HTTP::Get.new(uri.request_uri)
r
eq['user-agent'] # => Ruby...
...存在する
場合にはそれを全て ", " で連結した文字列を返します。
key は大文字小文字を区別しません。

@param key ヘッダフィール名を文字列で与えます。

@see Net::HTTPHeader#[]=,
Net::HTTPHeader#add_field,
Net::HTTPHeader#get_fields...
<< 1 2 > >>