キーワード
-
caller
_ locations (24) -
clock
_ gettime (12) -
count
_ tdata _ objects (12) - detach (12)
- dump (24)
-
pipeline
_ r (24) -
pipeline
_ rw (24) -
pipeline
_ start (24) -
pipeline
_ w (24) - popen2 (24)
- popen2e (24)
- popen3 (24)
- timeout (21)
検索結果
先頭5件
-
DRb
. # thread -> Thread|nil (24303.0) -
プライマリサーバが動作しているスレッドを返します。
...プライマリサーバが動作しているスレッドを返します。
プライマリサーバが存在しない場合は nil を返します。
@see DRb.#primary_server... -
Process
. # detach(pid) -> Thread (6202.0) -
子プロセス pid の終了を監視するスレッドを生成して返します。 生成したスレッドは子プロセスが終了した後に終了ステータス (Process::Status) を返します。 指定した子プロセスが存在しなければ即座に nil で終了します。
...ス pid の終了を監視するスレッドを生成して返します。
生成したスレッドは子プロセスが終了した後に終了ステータス (Process::Status) を返します。
指定した子プロセスが存在しなければ即座に nil で終了します。
@param pid 子......のプロセス ID を整数で指定します。
@raise NotImplementedError メソッドが現在のプラットフォームで実装されていない場合に発生します。
pid = fork {
# child
sleep 3
}
p pid # => 7762
th = Process.detach(pid)
p th.value......# => #<Process::Status: pid 7762 exit 0>... -
Marshal
. # dump(obj , limit = -1) -> String (6107.0) -
obj を指定された出力先に再帰的に出力します。
...い Class/Module オブジェクト。(この場
合は、例外 ArgumentError が発生します。無名クラスについて
は、Module.new を参照。)
* システムがオブジェクトの状態を保持するもの。具体的には以下のイン
スタンス。Dir, File::Stat,......IO とそのサブクラス
File, Socket など。
* MatchData, Data, Method, UnboundMethod,
Proc, Thread, ThreadGroup, Continuation
のインスタンス。
* 特異メソッドを定義したオブジェクト
また、これらのオブジェクトを間接的に指すオブジェク......ックを持った Hash は
Proc を間接的に指していることになります。
//emlist[例][ruby]{
p Marshal.dump(Hash.new {})
# => -:1:in `dump': cannot dump hash with default proc (TypeError)
//}
マーシャルの動作を任意に定義することもできます。
@param obj ダ... -
Marshal
. # dump(obj , port , limit = -1) -> IO (6107.0) -
obj を指定された出力先に再帰的に出力します。
...い Class/Module オブジェクト。(この場
合は、例外 ArgumentError が発生します。無名クラスについて
は、Module.new を参照。)
* システムがオブジェクトの状態を保持するもの。具体的には以下のイン
スタンス。Dir, File::Stat,......IO とそのサブクラス
File, Socket など。
* MatchData, Data, Method, UnboundMethod,
Proc, Thread, ThreadGroup, Continuation
のインスタンス。
* 特異メソッドを定義したオブジェクト
また、これらのオブジェクトを間接的に指すオブジェク......ックを持った Hash は
Proc を間接的に指していることになります。
//emlist[例][ruby]{
p Marshal.dump(Hash.new {})
# => -:1:in `dump': cannot dump hash with default proc (TypeError)
//}
マーシャルの動作を任意に定義することもできます。
@param obj ダ... -
ObjectSpace
. # count _ tdata _ objects(result _ hash = nil) -> Hash (6107.0) -
T_DATA の種類ごとにオブジェクトの数を格納したハッシュを返します。
...T_DATA の種類ごとにオブジェクトの数を格納したハッシュを返します。
@param result_hash 戻り値のためのハッシュを指定します。省略した場合は新
しくハッシュを作成します。result_hash の内容は上書き......ObjectSpace.count_tdata_objects
# => {RubyVM::InstructionSequence=>504, :parser=>5, :barrier=>6,
# :mutex=>6, Proc=>60, RubyVM::Env=>57, Mutex=>1, Encoding=>99,
# ThreadGroup=>1, Binding=>1, Thread=>1, RubyVM=>1, :iseq=>1,
# Random=>1, ARGF.class=>1, Data=>1, :autoload=>3, Time=>2}
//}......クラスオブジェクトです。それ
以外の内部的なオブジェクトの場合、キーはシンボルです。シンボルの値は
rb_data_type_struct に格納された名前が使用されます。
戻り値のハッシュは処理系に依存します。これは将来変更にな... -
Kernel
. # caller _ locations(range) -> [Thread :: Backtrace :: Location] | nil (225.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...現在のフレームを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@pa......。
//emlist[例][ruby]{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []......(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'"]
# => [9, 13]
# => ["/Users/user/test.rb", "/Users/user/test.rb"]
test3(2, 1)
# => ["/Users/user/test.rb:13:in `test3'"]
# => [13]
# => ["/Users/user/test.rb"]
//}
@see Thread::Backtrace::Location, Kernel.#caller... -
Kernel
. # caller _ locations(start = 1 , length = nil) -> [Thread :: Backtrace :: Location] | nil (225.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...現在のフレームを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@pa......。
//emlist[例][ruby]{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []......(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'"]
# => [9, 13]
# => ["/Users/user/test.rb", "/Users/user/test.rb"]
test3(2, 1)
# => ["/Users/user/test.rb:13:in `test3'"]
# => [13]
# => ["/Users/user/test.rb"]
//}
@see Thread::Backtrace::Location, Kernel.#caller... -
Open3
. # pipeline _ r(*cmds) -> [IO , [Thread]] (202.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。最後の コマンドの標準出力を受けとる事ができます。
...標準出力を受けとる事ができます。
@param cmds 実行するコマンドのリストを指定します。それぞれのコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す......cmdname にはコマンド名を表す String を指定します。
1、2、3 は shell 経由で実行されます。
(1) commandline
(2) [commandline, options]
(3) [env, commandline, options]
(4) [env, cmdname, arg1, arg2, ..., options]
(5) [env, [cmdname, argv0], ar......します。
例:
require "open3"
Open3.pipeline_r("yes", "head -10") {|r, ts|
p r.read #=> "y\ny\ny\ny\ny\ny\ny\ny\ny\ny\n"
p ts[0].value #=> #<Process::Status: pid 24910 SIGPIPE (signal 13)>
p ts[1].value #=> #<Process::Status: pid 24913 exit 0>
}
@see Open3.#popen3... -
Open3
. # pipeline _ rw(*cmds) -> [IO , IO , [Thread]] (202.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。最初の コマンドの標準入力に書き込む事も最後のコマンドの標準出力を受けとる事も できます。
...標準出力を受けとる事も
できます。
@param cmds 実行するコマンドのリストを指定します。それぞれのコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す......cmdname にはコマンド名を表す String を指定します。
1、2、3 は shell 経由で実行されます。
(1) commandline
(2) [commandline, options]
(3) [env, commandline, options]
(4) [env, cmdname, arg1, arg2, ..., options]
(5) [env, [cmdname, argv0], ar......例:
require "open3"
Open3.pipeline_rw("sort", "cat -n") {|stdin, stdout, wait_thrs|
stdin.puts "foo"
stdin.puts "bar"
stdin.puts "baz"
# sortコマンドにEOFを送る。
stdin.close
# stdinに渡した文字列をsortコマンドが並べ替えたもの...