114件ヒット
[1-100件を表示]
(0.124秒)
ライブラリ
- ビルトイン (66)
-
irb
/ cmd / help (12) - optparse (24)
- win32ole (12)
クラス
- Fiber (18)
-
IRB
:: ExtendCommand :: Help (12) - OptionParser (24)
-
Process
:: Status (12) - Thread (36)
- WIN32OLE (12)
検索結果
先頭5件
-
Thread
# exit -> self (18138.0) -
スレッドの実行を終了させます。終了時に ensure 節が実行されます。
...#exit(0)
により終了します。
Kernel.#exit と違い例外 SystemExit を発生しません。
th1 = Thread.new do
begin
sleep 10
ensure
p "this will be displayed"
end
end
sleep 0.1
th1.kill
#=> "this will be displayed"
@see Kernel.#exit, Kernel.#exit!... -
WIN32OLE
# ole _ respond _ to?(name) -> bool (6119.0) -
指定したメソッドをオブジェクトがサポートしているか調べます。
...されません。
@param name 調べるメソッド名を文字列またはシンボルで指定します。
@return nameで指定したメソッドをオブジェクトが提供していれば真を返します。
excel = WIN32OLE.new('Excel.Application')
excel.ole_respond_to?(:quit) #=>......true
excel.ole_respond_to?(:exit) #=> false... -
OptionParser
# separator(sep) -> () (6113.0) -
サマリにオプションを区切るための文字列 sep を挿入します。 オプションにいくつかの種類がある場合に、サマリがわかりやすくなります。
...サマリにオプションを区切るための文字列 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.libra......ry << lib
end
opts.separator ""
opts.separator "Common options:"
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
//}... -
Thread
# kill -> self (3038.0) -
スレッドの実行を終了させます。終了時に ensure 節が実行されます。
...#exit(0)
により終了します。
Kernel.#exit と違い例外 SystemExit を発生しません。
th1 = Thread.new do
begin
sleep 10
ensure
p "this will be displayed"
end
end
sleep 0.1
th1.kill
#=> "this will be displayed"
@see Kernel.#exit, Kernel.#exit!... -
Thread
# terminate -> self (3038.0) -
スレッドの実行を終了させます。終了時に ensure 節が実行されます。
...#exit(0)
により終了します。
Kernel.#exit と違い例外 SystemExit を発生しません。
th1 = Thread.new do
begin
sleep 10
ensure
p "this will be displayed"
end
end
sleep 0.1
th1.kill
#=> "this will be displayed"
@see Kernel.#exit, Kernel.#exit!... -
OptionParser
# on _ tail(*arg , &block) -> self (3031.0) -
オプションを取り扱うためのブロックを自身の持つリストの最後に登録します。
...elp の説明をサマリの最後に表示したい時に便利です。
@param arg OptionParser#on と同様です。
@param block OptionParser#on と同様です。
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--upda......te")
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("--ver......sion", "Show version") do
puts OptionParser::Version.join('.')
exit
end
//}
@see OptionParser#on, OptionParser#on_head... -
IRB
:: ExtendCommand :: Help # execute(*names) -> nil (3013.0) -
RI から Ruby のドキュメントを参照します。
...RI から Ruby のドキュメントを参照します。
irb(main):001:0> help String#match
...
@param names 参照したいクラス名やメソッド名などを文字列で指定します。
names を指定しなかった場合は、RI を対話的なモードで起動します。メソ......rb(main):001:0> help
Enter the method name you want to look up.
You can use tab to autocomplete.
Enter a blank line to exit.
>> String#match
String#match
(from ruby core)
------------------------------------------------------------------------------
str.match(pattern) ->......matchdata or nil
str.match(pattern, pos) -> matchdata or nil
...... -
Process
:: Status # >>(num) -> Integer (3013.0) -
self.to_i >> num と同じです。
...self.to_i >> num と同じです。
@param num 整数を指定します。
fork { exit 99 } #=> 26563
Process.wait #=> 26563
$?.to_i #=> 25344
$? >> 8 #=> 99... -
Fiber
# raise(exception , message = nil , backtrace = nil) -> object (143.0) -
selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
...数をメッセージとした RuntimeError
が発生します。
その他のケースでは、最初の引数は Exception か Exception
のインスタンスを返す exception メソッドを持ったオブジェクトである
必要があります。
この場合、2つ目の引数に例外......た3つ目の引数に
例外発生時のスタックトレースを指定できます。
@param message 例外のメッセージとなる文字列です。
@param exception 発生させる例外です。
@param backtrace 例外発生時のスタックトレースです。文字列の配列で指......{ Fiber.yield }
f.resume
f.raise "Error!" # => Error! (RuntimeError)
//}
//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fiber.new do
loop do
Fiber.yield(:loop)
end
:exit
end
p f.resume # => :loop
p f.raise StopIteration # => :exit
//}...