444件ヒット
[1-100件を表示]
(0.056秒)
別のキーワード
ライブラリ
- ビルトイン (36)
-
net
/ http (324) - optparse (36)
-
rexml
/ document (12) - socket (36)
クラス
- Addrinfo (24)
- Exception (24)
- Module (12)
-
Net
:: HTTP (132) -
Net
:: HTTPGenericRequest (12) -
Net
:: HTTPResponse (108) - OptionParser (24)
-
REXML
:: Instruction (12) - Socket (12)
モジュール
-
Net
:: HTTPExceptions (12) -
Net
:: HTTPHeader (60) -
OptionParser
:: Arguable (12)
キーワード
- == (12)
-
backtrace
_ locations (12) - body (12)
- code (12)
- connect (12)
-
connect
_ from (24) -
const
_ get (12) -
content
_ length (12) -
content
_ length= (12) -
content
_ range (12) -
content
_ type= (12) - entity (12)
- get2 (24)
- getopts (36)
- head2 (24)
-
http
_ version (12) - msg (12)
-
read
_ body (24) -
request
_ get (24) -
request
_ head (24) - response (12)
-
response
_ body _ permitted? (12) -
send
_ request (12) -
set
_ content _ type (12) - target (12)
- value (12)
検索結果
先頭5件
- Net
:: HTTP # get(path , header = nil , dest = nil) -> Net :: HTTPResponse - Net
:: HTTP # get(path , header = nil , dest = nil) {|body _ segment| . . . . } -> Net :: HTTPResponse - Module
# const _ get(name , inherit = true) -> object - Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] - OptionParser
:: Arguable # getopts(short _ opt , *long _ opt) -> Hash
-
Net
:: HTTP # get(path , header = nil , dest = nil) -> Net :: HTTPResponse (18245.0) -
サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。
...サーバ上の path にあるエンティティを取得し、
Net::HTTPResponse のインスタンスとして返します。
header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } という......されたときは
エンティティボディを少しずつ文字列として
ブロックに与えます。このとき戻り値の
Net::HTTPResponse オブジェクトは有効な body を
持ちません。
dest は時代遅れの引数です。利用しないでください。
dest を指定......ist[例][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/'... -
Net
:: HTTP # get(path , header = nil , dest = nil) {|body _ segment| . . . . } -> Net :: HTTPResponse (18245.0) -
サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。
...サーバ上の path にあるエンティティを取得し、
Net::HTTPResponse のインスタンスとして返します。
header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } という......されたときは
エンティティボディを少しずつ文字列として
ブロックに与えます。このとき戻り値の
Net::HTTPResponse オブジェクトは有効な body を
持ちません。
dest は時代遅れの引数です。利用しないでください。
dest を指定......ist[例][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/'... -
Module
# const _ get(name , inherit = true) -> object (12244.0) -
name で指定される名前の定数の値を取り出します。
...name で指定される名前の定数の値を取り出します。
Module#const_defined? と違って Object を特別扱いすることはありません。
@param name 定数名。String か Symbol で指定します。
完全修飾名を指定しなかった場合はモジュー......す。
//emlist[例][ruby]{
module Bar
BAR = 1
end
class Object
include Bar
end
# Object では include されたモジュールに定義された定数を見付ける
p Object.const_get(:BAR) # => 1
class Baz
include Bar
end
# Object以外でも同様
p Baz.const_get(:BAR) # => 1
#......定義されていない定数
p Baz.const_get(:NOT_DEFINED) #=> raise NameError
# 第二引数に false を指定すると自分自身に定義された定数から探す
p Baz.const_get(:BAR, false) #=> raise NameError
# 完全修飾名を指定すると include や自分自身へ定義されて... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (9231.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...。Exception#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return......month, -1).day == 31
raise "#{month} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `get_e......xception'", "test.rb:15:in `<main>'"]
//}
@see Exception#backtrace... -
OptionParser
:: Arguable # getopts(short _ opt , *long _ opt) -> Hash (9225.0) -
指定された short_opt や long_opt に応じて自身をパースし、結果を Hash として返します。
...指定された short_opt や long_opt に応じて自身をパースし、結果を Hash として返します。
コマンドラインに - もしくは -- を指定した場合、それ以降の解析を行ないません。
@param short_opt ショートネームのオプション(-f や -fx)......を指定します。
オプションが引数をとる場合は直後に ":" を付けます。
@param long_opt ロングネームのオプション(--version や --bufsize=512)を文字列で指定をします。
オプションが引数をとる場合は後ろに......se OptionParser::ParseError 自身のパースに失敗した場合、発生します。
実際は OptionParser::ParseError のサブク
ラスの例外になります。
//emlist[t.rb][ruby]{
require 'optparse'
params = ARGV.getopts("... -
Net
:: HTTPExceptions # response -> Net :: HTTPResponse (9219.0) -
例外の原因となったレスポンスオブジェクトを返します。
...レスポンスオブジェクトを返します。
//emlist[例][ruby]{
require 'net/http'
uri = "http://www.example.com/invalid.html"
response = Net::HTTP.get_response(URI.parse(uri))
begin
response.value
rescue => e
e.response # => #<Net::HTTPNotFound 404 Not Found readbody=true>
end
//}... -
Net
:: HTTPResponse # http _ version -> String (9119.0) -
サーバがサポートしている HTTP のバージョンを文字列で返します。
...サーバがサポートしている HTTP のバージョンを文字列で返します。
//emlist[例][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.http_version # => "1.1"
//}... -
OptionParser
# getopts(*opts) -> Hash (9113.0) -
引数をパースした結果を、Hash として返します。
...与えた場合、argv をパースします。そうでない場合は、
default_argv をパースします。
//emlist[][ruby]{
opt = OptionParser.new
params = opt.getopts(ARGV, "ab:", "foo", "bar:")
# params["a"] = true # -a
# params["b"] = "1" # -b1
# params["foo"] = true # --foo
# param......列を指定します。
@param opts 引数を文字列で指定します。
@raise OptionParser::ParseError パースに失敗した場合、発生します。
実際は OptionParser::ParseError のサブク
ラスになります。... -
OptionParser
# getopts(argv , *opts) -> Hash (9113.0) -
引数をパースした結果を、Hash として返します。
...与えた場合、argv をパースします。そうでない場合は、
default_argv をパースします。
//emlist[][ruby]{
opt = OptionParser.new
params = opt.getopts(ARGV, "ab:", "foo", "bar:")
# params["a"] = true # -a
# params["b"] = "1" # -b1
# params["foo"] = true # --foo
# param......列を指定します。
@param opts 引数を文字列で指定します。
@raise OptionParser::ParseError パースに失敗した場合、発生します。
実際は OptionParser::ParseError のサブク
ラスになります。...