るりまサーチ

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

別のキーワード

  1. string []=
  2. string slice!
  3. string slice
  4. string []
  5. string gsub

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 > >>

CGI#header(options = "text/html") -> String (18358.0)

HTTP ヘッダを options に従って生成します。 CGI#out と違い、標準出力には出力しません。 CGI#out を使わずに自力で HTML を出力したい場合などに使います。 このメソッドは文字列エンコーディングを変換しません。

...506 Variant Also Negotiates"

@
param options Hash か文字列で HTTP ヘッダを生成するための情報を指定します。

例:
header

# Content-Type: text/html

header
("text/plain")
# Content-Type: text/plain

header
({"nph" => true,...
..."my_header1" => "my_value",
"my_header2" => "my_value"})

例:
cgi = CGI.new('html3')
print cgi.header({"charset" => "shift_jis", "status" => "OK"})
print "<html><head><title>TITLE</title></head>\r\n"
print "<body>BODY</body></html>\r\n"

@
see 359...

URI::MailTo#headers -> [[String]] (6321.0)

自身のヘッダーを文字列の配列の配列として設定します。

...自身のヘッダーを文字列の配列の配列として設定します。

例:
require 'uri'
m = URI.parse("mailto:ruby-list@ruby-lang.org?subject=subscribe&cc=myaddr")
p m.headers #=> [["subject", "subscribe"], ["cc", "myaddr"]]...

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

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

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

@
param key ヘッダフィール名を文字列で与えます。
@
param default 該当するキーが登録されていない時の返り値を指定します。
@
raise IndexError 引数defaultもブロックも与えられてない...
...ey のみ指定。key が存在する][ruby]{
require 'net/http'

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

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

begin
req.fet...
...emlist[例 key , default を指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}

//emlist[例 key とブロックを指定][ruby]{
require 'net/http'

uri = URI.par...

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

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

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

@
param key ヘッダフィール名を文字列で与えます。
@
param default 該当するキーが登録されていない時の返り値を指定します。
@
raise IndexError 引数defaultもブロックも与えられてない...
...ey のみ指定。key が存在する][ruby]{
require 'net/http'

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

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

begin
req.fet...
...emlist[例 key , default を指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}

//emlist[例 key とブロックを指定][ruby]{
require 'net/http'

uri = URI.par...

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

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

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

@
param key ヘッダフィール名を文字列で与えます。
@
param default 該当するキーが登録されていない時の返り値を指定します。
@
raise IndexError 引数defaultもブロックも与えられてない...
...ey のみ指定。key が存在する][ruby]{
require 'net/http'

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

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

begin
req.fet...
...emlist[例 key , default を指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}

//emlist[例 key とブロックを指定][ruby]{
require 'net/http'

uri = URI.par...

絞り込み条件を変える

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

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

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

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

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

一種類のヘッダフィールドが一つのヘッダの中に複...
...存在する
場合にはそれを全て ", " で連結した文字列を返します。
key は大文字小文字を区別しません。

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

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

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

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

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

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

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

uri = URI.parse('http://www.example.com/index.html')
req = Net:...

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

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

...ィールドを削除します。

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

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

uri = URI.p...

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

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

...ん。

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

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

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

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