るりまサーチ

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

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. fileutils chmod_r
  5. fileutils cp_r

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

CSV::FieldInfo#header -> String | nil (24321.0)

利用可能な場合はヘッダを表す文字列を返します。

...字列を返します。

//emlist[例][ruby]{
require
'csv'

csv = CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true)
csv.convert do |field,field_info|
p field_info.header
Date.parse(field)
end
p csv.first

# => "date1"
# => "date2"
# => #<CSV::Row "date1":#<Date: 2018-07-09 ((2458309...

URI::MailTo#headers -> [[String]] (12314.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#proxy_basic_auth(account, password) -> [String] (9214.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 (6246.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 (6246.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 (6246.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 (6214.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] (6214.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 (6214.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"
//}...
<< 1 2 > >>