るりまサーチ

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

別のキーワード

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

ライブラリ

キーワード

検索結果

<< 1 2 > >>

Net::HTTPHeader#proxy_basic_auth(account, password) -> [String] (6209.0)

Proxy 認証のために Proxy-Authorization: ヘッダをセットします。

...Proxy 認証のために Proxy-Authorization: ヘッダをセットします。

@param account アカウント名を文字列で与えます。
@param password パスワードを文字列で与えます。

//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.proxy_basic_auth("account", "password") # => ["Basic YWNjb3VudDpwYXNzd29yZA=="]
//}...

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

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

...す。
key は大文字小文字を区別しません。

@param key ヘッダフィール名を文字列で与えます。
@param default 該当するキーが登録されていない時の返り値を指定します。
@raise IndexError 引数defaultもブロックも与えられてない時、キ...
...する][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 =>...
...e
e # => #<KeyError: key not found: "content-length">
end
//}

//emlist[例 key , default を指定][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("content-length", "default") # => "default"
//}

//emlist[例 key...

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

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

...す。
key は大文字小文字を区別しません。

@param key ヘッダフィール名を文字列で与えます。
@param default 該当するキーが登録されていない時の返り値を指定します。
@raise IndexError 引数defaultもブロックも与えられてない時、キ...
...する][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 =>...
...e
e # => #<KeyError: key not found: "content-length">
end
//}

//emlist[例 key , default を指定][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("content-length", "default") # => "default"
//}

//emlist[例 key...

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

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

...す。
key は大文字小文字を区別しません。

@param key ヘッダフィール名を文字列で与えます。
@param default 該当するキーが登録されていない時の返り値を指定します。
@raise IndexError 引数defaultもブロックも与えられてない時、キ...
...する][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 =>...
...e
e # => #<KeyError: key not found: "content-length">
end
//}

//emlist[例 key , default を指定][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("content-length", "default") # => "default"
//}

//emlist[例 key...

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

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

...す。キーが存在しなければ 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...

絞り込み条件を変える

Net::HTTPHeader#basic_auth(account, password) -> [String] (3209.0)

Authorization: ヘッダを BASIC 認証用にセットします。

...Authorization: ヘッダを BASIC 認証用にセットします。

@param account アカウント名を文字列で与えます。
@param password パスワードを文字列で与えます。

//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.basic_auth("user", "pass") # => ["Basic dXNlcjpwYXNz"]
//}...

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

"text/html" のような 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#delete(key) -> [String] | nil (3209.0)

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

...します。

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

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

uri = URI.parse('http://www.exam...
...ple.com/index.html')
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] (3209.0)

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...
<< 1 2 > >>