種類
- インスタンスメソッド (253)
- 特異メソッド (11)
クラス
- CSV (11)
-
CSV
:: FieldInfo (11) -
CSV
:: Row (11) -
Net
:: HTTP (220)
モジュール
- Kernel (11)
キーワード
-
create
_ header (11) - get (22)
- get2 (22)
- head (11)
- head2 (22)
- new (11)
- patch (22)
- post (22)
- post2 (22)
-
request
_ get (22) -
request
_ head (22) -
request
_ post (22) -
send
_ request (11) -
write
_ headers? (11)
検索結果
先頭5件
-
CSV
:: FieldInfo # header=(val) (24200.0) -
ヘッダを表す文字列をセットします。
...ヘッダを表す文字列をセットします。
@param val ヘッダを表す文字列を指定します。... -
CSV
# write _ headers? -> bool (6206.0) -
ヘッダを出力先に書き込む場合は真を返します。 そうでない場合は偽を返します。
...emlist[例][ruby]{
require "csv"
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10")
csv.write_headers? # => nil
header = ["header1", "header2"]
row = ["row1_1", "row1_2"]
result = CSV.generate(headers: header, write_headers: false) do |csv|
csv.write_headers? # => false
csv << row
end
result......# => "row1_1,row1_2\n"
result = CSV.generate(headers: header, write_headers: true) do |csv|
csv.write_headers? # => true
csv << row
end
result # => "header1,header2\nrow1_1,row1_2\n"
//}
@see CSV.new... -
Kernel
# create _ header(header = "extconf . h") -> String (3101.0) -
Kernel#have_func, Kernel#have_header などの検査結果を元に、 ヘッダファイルを生成します。
...Kernel#have_func, Kernel#have_header などの検査結果を元に、
ヘッダファイルを生成します。
このメソッドは extconf.rb の最後で呼び出すようにしてください。
@param header ヘッダファイルの名前を指定します。
@return ヘッダファイ......# extconf.rb
require 'mkmf'
have_func('realpath')
have_header('sys/utime.h')
create_header
create_makefile('foo')
上の extconf.rb は以下の extconf.h を生成します。
#ifndef EXTCONF_H
#define EXTCONF_H
#define HAVE_REALPATH 1
#define HAVE_SYS_UTIME_H 1
#endif... -
Net
:: HTTP # get(path , header = nil , dest = nil) -> Net :: HTTPResponse (302.0) -
サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。
...サーバ上の path にあるエンティティを取得し、
Net::HTTPResponse のインスタンスとして返します。
header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } という......となります。
//emlist[例][ruby]{
# net/http version 1.1
response, body = http.get( '/index.html' )
# net/http version 1.2
response = http.get('/index.html')
# compatible in both version
response , = http.get('/index.html')
response.body
# compatible, using block
File.open('save.txt', 'w')......{|f|
http.get('/~foo/', nil) do |str|
f.write str
end
}
//}
@see Net::HTTP#request_get... -
Net
:: HTTP # get(path , header = nil , dest = nil) {|body _ segment| . . . . } -> Net :: HTTPResponse (302.0) -
サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。
...サーバ上の path にあるエンティティを取得し、
Net::HTTPResponse のインスタンスとして返します。
header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } という......となります。
//emlist[例][ruby]{
# net/http version 1.1
response, body = http.get( '/index.html' )
# net/http version 1.2
response = http.get('/index.html')
# compatible in both version
response , = http.get('/index.html')
response.body
# compatible, using block
File.open('save.txt', 'w')......{|f|
http.get('/~foo/', nil) do |str|
f.write str
end
}
//}
@see Net::HTTP#request_get... -
Net
:: HTTP # post(path , data , header = nil , dest = nil) -> Net :: HTTPResponse (302.0) -
サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。
...ダに Content-Type: を指定する必要があります。
もし header に指定しなかったならば、 Content-Type として
"application/x-www-form-urlencoded" を用います。
dest は時代遅れの引数です。利用しないでください。
dest を指定した場合には
ボ......す。
//emlist[例][ruby]{
# net/http version 1.1
response, body = http.post('/cgi-bin/search.rb', 'query=subject&target=ruby')
# version 1.2
response = http.post('/cgi-bin/search.rb', 'query=subject&target=ruby')
# using block
File.open('save.html', 'w') {|f|
http.post('/cgi-bin/search.rb', '......query=subject&target=ruby') do |str|
f.write str
end
}
//}
@see Net::HTTP#request_post... -
Net
:: HTTP # post(path , data , header = nil , dest = nil) {|body _ segment| . . . . } -> Net :: HTTPResponse (302.0) -
サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。
...ダに Content-Type: を指定する必要があります。
もし header に指定しなかったならば、 Content-Type として
"application/x-www-form-urlencoded" を用います。
dest は時代遅れの引数です。利用しないでください。
dest を指定した場合には
ボ......す。
//emlist[例][ruby]{
# net/http version 1.1
response, body = http.post('/cgi-bin/search.rb', 'query=subject&target=ruby')
# version 1.2
response = http.post('/cgi-bin/search.rb', 'query=subject&target=ruby')
# using block
File.open('save.html', 'w') {|f|
http.post('/cgi-bin/search.rb', '......query=subject&target=ruby') do |str|
f.write str
end
}
//}
@see Net::HTTP#request_post... -
Net
:: HTTP # send _ request(name , path , data = nil , header = nil) -> Net :: HTTPResponse (301.0) -
HTTP リクエストをサーバに送り、そのレスポンスを Net::HTTPResponse のインスタンスとして返します。
...スを文字列で与えます。
@param data リクエストのボディを文字列で与えます。
@param header リクエストのヘッダをハッシュで与えます。
//emlist[例][ruby]{
response = http.send_request('GET', '/index.html')
puts response.body
//}
@see Net::HTTP#request... -
Net
:: HTTP # patch(path , data , initheader=nil , dest=nil) -> Net :: HTTPResponse (300.0) -
サーバ上の path にあるエンティティに対し文字列 data を PATCH リクエストで送ります。
サーバ上の path にあるエンティティに対し文字列 data を
PATCH リクエストで送ります。
返り値は Net::HTTPResponse のインスタンスです。
ブロックと一緒に呼びだされたときはエンティティボディを少しずつ文字列として
ブロックに与えます。このとき戻り値の HTTPResponse オブジェクトは有効な body を
持ちません。
Dest は時代遅れの引数です。利用しないでください。
dest を指定した場合には
ボディを少しずつ取得して順次
「dest << ボディの断片」を実行します。
@param path POST先のパスを文字列で指定します。... -
Net
:: HTTP # patch(path , data , initheader=nil , dest=nil) {|body _ segment| . . . } -> Net :: HTTPResponse (300.0) -
サーバ上の path にあるエンティティに対し文字列 data を PATCH リクエストで送ります。
サーバ上の path にあるエンティティに対し文字列 data を
PATCH リクエストで送ります。
返り値は Net::HTTPResponse のインスタンスです。
ブロックと一緒に呼びだされたときはエンティティボディを少しずつ文字列として
ブロックに与えます。このとき戻り値の HTTPResponse オブジェクトは有効な body を
持ちません。
Dest は時代遅れの引数です。利用しないでください。
dest を指定した場合には
ボディを少しずつ取得して順次
「dest << ボディの断片」を実行します。
@param path POST先のパスを文字列で指定します。...