るりまサーチ

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

別のキーワード

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

ライブラリ

キーワード

検索結果

<< 1 2 > >>

Net::HTTPResponse#message -> String (21126.0)

HTTP サーバがリザルトコードに付加して返すメッセージです。 例えば 'Not Found' などです。

...して返すメッセージです。
例えば 'Not Found' などです。

msg は obsolete です。使わないでください。

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

uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.message # => "OK"
//}...

OptionParser#on_tail(*arg, &block) -> self (9198.0)

オプションを取り扱うためのブロックを自身の持つリストの最後に登録します。

...sion や --help の説明をサマリの最後に表示したい時に便利です。

@param arg OptionParser#on と同様です。

@param block OptionParser#on と同様です。

//emlist[例][ruby]{
require
"optparse"

opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("...
...pts.on_tail("-h", "--help")
end

puts opts.help

# => Usage: test [options]
# -i, --init
# -u, --update
# -h, --help
//}

//emlist[例][ruby]{
require
"optparse"

opts = OptionParser.new
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end

opts.on_tail("--version", "...
...Show version") do
puts OptionParser::Version.join('.')
exit
end
//}

@see OptionParser#on, OptionParser#on_head...

Net::HTTPResponse#msg -> String (6026.0)

HTTP サーバがリザルトコードに付加して返すメッセージです。 例えば 'Not Found' などです。

...して返すメッセージです。
例えば 'Not Found' などです。

msg は obsolete です。使わないでください。

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

uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.message # => "OK"
//}...

Exception#==(other) -> bool (3053.0)

自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。

...自身と指定された other のクラスが同じであり、
message
と backtrace が == メソッドで比較して
等しい場合に true を返します。そうでない場合に false を返します。

@param other 自身と比較したいオブジェクトを指定します。...
...した場合は
Exception#exception を実行して変換を試みます。

//emlist[例][ruby]{
require
"date"
def check_long_month(month)
return if Date.new(2000, month, -1).day == 31
raise "#{month} is not long month"
end

def get_exception
return begin
yield
rescue => e...
...= [2, 2, 4].map { |e | get_exception { check_long_month(e) } }
p results.map { |e| e.class }
# => [RuntimeError, RuntimeError, RuntimeError]
p results.map { |e| e.message }
# => ["2 is not long month", "2 is not long month", "4 is not long month"]

# class, message, backtrace が同一のため tru...

OptionParser#separator(sep) -> () (3049.0)

サマリにオプションを区切るための文字列 sep を挿入します。 オプションにいくつかの種類がある場合に、サマリがわかりやすくなります。

...サマリには on メソッドを呼んだ順にオプションが表示されるので、区切りを挿入したい
ところでこのメソッドを呼びます。

@param sep サマリの区切りを文字列で指定します。

//emlist[][ruby]{
require
'optparse'
opts = OptionParser.new
opt...
...ner = "Usage: example.rb [options]"

opts.separator ""
opts.separator "Specific options:"

opts.on("-r", "--require LIBRARY") do |lib|
options.library << lib
end

opts.separator ""
opts.separator "Common options:"

opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
/...

絞り込み条件を変える

Net::HTTPResponse#value -> nil (3043.0)

レスポンスが 2xx(成功)でなかった場合に、対応する 例外を発生させます。

...ception レスポンスが 4xx である場合に発生します。
@raise HTTPFatalError レスポンスが 5xx である場合に発生します。

//emlist[例 レスポンスが 2xx(成功)][ruby]{
require
'net/http'

uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(U...
...se(uri))
response.value # => nil
//}

//emlist[例 レスポンスが 2xx以外][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.class # => Net::HTTPServerException
e.message # => 404 "N...

Thread::SizedQueue#deq(non_block = false) -> object (143.0)

キューからひとつ値を取り出します。 キューに push しようと待っているスレッドがあれば、実行を再開させます。

...と待っているスレッドがあれば、実行を再開させます。

@param non_block true を与えると、キューが空の時に例外 ThreadError が発生します。

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

q = SizedQueue.new(4)

th1 = Thread.start do
while resource = q.pop
puts...
...//emlist[例: nonblock = true][ruby]{
require
'thread'

q = SizedQueue.new(4)

th1 = Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}

begin
th1.join
q.pop(true)
rescue => e
p e
p e.message
end

# => resou...

Thread::SizedQueue#pop(non_block = false) -> object (143.0)

キューからひとつ値を取り出します。 キューに push しようと待っているスレッドがあれば、実行を再開させます。

...と待っているスレッドがあれば、実行を再開させます。

@param non_block true を与えると、キューが空の時に例外 ThreadError が発生します。

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

q = SizedQueue.new(4)

th1 = Thread.start do
while resource = q.pop
puts...
...//emlist[例: nonblock = true][ruby]{
require
'thread'

q = SizedQueue.new(4)

th1 = Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}

begin
th1.join
q.pop(true)
rescue => e
p e
p e.message
end

# => resou...

Thread::SizedQueue#shift(non_block = false) -> object (143.0)

キューからひとつ値を取り出します。 キューに push しようと待っているスレッドがあれば、実行を再開させます。

...と待っているスレッドがあれば、実行を再開させます。

@param non_block true を与えると、キューが空の時に例外 ThreadError が発生します。

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

q = SizedQueue.new(4)

th1 = Thread.start do
while resource = q.pop
puts...
...//emlist[例: nonblock = true][ruby]{
require
'thread'

q = SizedQueue.new(4)

th1 = Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}

begin
th1.join
q.pop(true)
rescue => e
p e
p e.message
end

# => resou...
<< 1 2 > >>