るりまサーチ

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

別のキーワード

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

ライブラリ

キーワード

検索結果

<< 1 2 > >>

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

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

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

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

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

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

OptionParser#on_tail(*arg, &block) -> self (15286.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("...
...-update")
opts.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...

WIN32OLE_TYPE#default_event_sources -> [WIN32OLE_TYPE] (9267.0)

型が持つソースインターフェイスを取得します。

...す。

default_event_sourcesメソッドは、selfがCoClass(コンポーネントクラス)
の場合、そのクラスがサポートするデフォルトのソースインターフェイス(イ
ベントの通知元となるインターフェイス)を返します。

@return デフォ...
...TYPEの配列と
して返します。返すのは配列ですが、デフォルトのソースインターフェ
イスは最大でも1インターフェイスです。ソースインターフェイスを持
たない場合は空配列を返します。

t
obj = WIN32OLE_T...
...YPE.new('Microsoft Excel 14.0 Object Library', 'Worksheet')
t
obj.default_event_sources.map {|intf| intf.name} #=> ["DocEvents"]

WIN32OLE_EVENT.newでインターフェイス名を指定しない場合は、ここで
返されたインターフェイスが選択されます。

次のサンプル...

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

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

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

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

//emlist[][ruby]{
require
'optparse'
opts = OptionParser.new
opts.banner...
...= "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#msg -> String (9120.0)

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

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

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

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

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

絞り込み条件を変える

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

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

...、実行を再開させます。

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

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

q = SizedQueue.new(4)

t
h1 = Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resourc...
...ush(r)
}

t
h1.join
# => resource1
# resource2
# resource3
//}

//emlist[例: nonblock = true][ruby]{
require
'thread'

q = SizedQueue.new(4)

t
h1 = Thread.start do
while resource = q.pop
puts resource
end
end

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

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

# => resource1
# resource2
# resource3
# => #<ThreadError: queue empty>
# => "queue empty"
//}

@see Thread::Queue#pop...

Exception#==(other) -> bool (6147.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
e
end
end

results = [...
...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 が同一のため true になる
p results[0...

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

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

...ます。

@raise HTTPError レスポンスが 1xx であるか、 net/http が知らない
種類のレスポンスである場合に発生します。
@raise HTTPRetriableError レスポンスが 3xx である場合に発生します。
@raise HTTPServerException レスポンス...
...
@raise HTTPFatalError レスポンスが 5xx である場合に発生します。

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

uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(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 "Not Found"
end
//}...

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

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

...、実行を再開させます。

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

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

q = SizedQueue.new(4)

t
h1 = Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resourc...
...ush(r)
}

t
h1.join
# => resource1
# resource2
# resource3
//}

//emlist[例: nonblock = true][ruby]{
require
'thread'

q = SizedQueue.new(4)

t
h1 = Thread.start do
while resource = q.pop
puts resource
end
end

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

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

# => resource1
# resource2
# resource3
# => #<ThreadError: queue empty>
# => "queue empty"
//}

@see Thread::Queue#pop...
<< 1 2 > >>