るりまサーチ

最速Rubyリファレンスマニュアル検索!
444件ヒット [101-200件を表示] (0.150秒)

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< < 1 2 3 4 ... > >>

Net::HTTPHeader#set_range(r) -> () (6128.0)

範囲を指定してエンティティを取得するためのヘッダ Range: をセットします。

...取得するためのヘッダ Range: をセットします。

以下は同じことを表しています。

//emlist[例][ruby]{
r
eq.range = 0..1023
r
eq.range = 0...1024
r
eq.range = 1024
r
eq.set_range(0, 1024)
r
eq.set_range(0..1023)
r
eq.set_range(0...1024)
r
eq.set_range(1024)
//}

特別な場合...
...
r
を x..-1 とした場合には、x が正ならば
x バイト目から最後までの範囲を、
x が負ならば最初から x バイト目までの範囲を表します。

@param r 範囲を Range オブジェクトで与えます。
@param i 範囲の始点を整数で与えます。
@par...
...am len 範囲の長さを整数で与えます。
@param n 0からの長さを整数で与えます。...

Net::HTTPHeader#each_header {|name, val| .... } -> () (6126.0)

保持しているヘッダ名とその値をそれぞれ ブロックに渡して呼びだします。

...mlist[例][ruby]{
r
equire 'net/http'

uri = URI.parse('http://www.example.com/index.html')
r
eq = Net::HTTP::Get.new(uri.request_uri)
r
eq.each_header { |key,value| puts "#{key} = #{value}" }

# => accept-encoding = gzip;q=1.0,deflate;q=0.6,identity;q=0.3
# => accept = */*
# => user-agent = Ruby
//}...

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

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

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

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

//emlist[例][ruby]{
r
equire '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#range_length -> Integer|nil (6114.0)

Content-Range: ヘッダフィールドの表している長さを整数で返します。

...Content-Range: ヘッダフィールドの表している長さを整数で返します。

ヘッダが設定されていない場合には nil を返します。

@raise Net::HTTPHeaderSyntaxError Content-Range: ヘッダフィールド
の値が不正である...
...発生します。


//emlist[例][ruby]{
r
equire 'net/http'

uri = URI.parse('http://www.example.com/index.html')
r
eq = Net::HTTP::Get.new(uri.request_uri)
r
eq['Content-Range'] = "bytes 1-500/1000"
r
eq.range_length # => 500
//}...

Net::HTTPHeader#type_params -> Hash (6114.0)

Content-Type のパラメータを {"charset" => "iso-2022-jp"} という形の Hash で返します。

...harset" => "iso-2022-jp"}
という形の Hash で返します。

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

//emlist[例][ruby]{
r
equire 'net/http'

uri = URI.parse('http://www.example.com/index.html')
r
es = Net::HTTP.get_response(uri...
...)
res.type_params # => {"charset"=>"UTF-8"}
//}...

絞り込み条件を変える

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

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

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

@param key ヘッダフィール名を文字列で与えます。
@param default 該当するキーが登録されていない時の返り値を指定します。
@raise IndexError 引数defaultもブロックも与えられてない時、キ...
...する][ruby]{
r
equire '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]{
r
equire 'net/http'

begin
r
eq.fetch("content-length")
r
escue =>...
...e
e # => #<KeyError: key not found: "content-length">
end
//}

//emlist[例 key , default を指定][ruby]{
r
equire '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 (3162.0)

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

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

@param key ヘッダフィール名を文字列で与えます。
@param default 該当するキーが登録されていない時の返り値を指定します。
@raise IndexError 引数defaultもブロックも与えられてない時、キ...
...する][ruby]{
r
equire '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]{
r
equire 'net/http'

begin
r
eq.fetch("content-length")
r
escue =>...
...e
e # => #<KeyError: key not found: "content-length">
end
//}

//emlist[例 key , default を指定][ruby]{
r
equire '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 (3162.0)

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

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

@param key ヘッダフィール名を文字列で与えます。
@param default 該当するキーが登録されていない時の返り値を指定します。
@raise IndexError 引数defaultもブロックも与えられてない時、キ...
...する][ruby]{
r
equire '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]{
r
equire 'net/http'

begin
r
eq.fetch("content-length")
r
escue =>...
...e
e # => #<KeyError: key not found: "content-length">
end
//}

//emlist[例 key , default を指定][ruby]{
r
equire '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 (3126.0)

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

...す。キーが存在しなければ nil を返します。

//emlist[例][ruby]{
r
equire '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 3 4 ... > >>