るりまサーチ

最速Rubyリファレンスマニュアル検索!
72件ヒット [1-72件を表示] (0.027秒)
トップページ > モジュール:Kernel[x] > クエリ:puts[x] > クエリ:Integer[x]

別のキーワード

  1. _builtin puts
  2. csv puts
  3. stringio puts
  4. io puts
  5. xmp puts

ライブラリ

キーワード

検索結果

Kernel.#fork -> Integer | nil (127.0)

fork(2) システムコールを使ってプロセスの複製を作 ります。親プロセスでは子プロセスのプロセスIDを、子プロセスでは nil を返します。ブロックを指定して呼び出した場合には、生成し た子プロセスでブロックを評価します。

...y]{
if child_pid = fork
puts
"parent process. pid: #{Process.pid}, child pid: #{child_pid}"
# => parent process. pid: 81060, child pid: 81329

# 親プロセスでの処理
# ...

# 子プロセスの終了を待って終了。
Process.waitpid(child_pid)
else
puts
"child process. pid:...
...ep(1)
end
//}

//emlist[ブロックを指定した場合][ruby]{
child_pid = fork do
puts
"child process. pid: #{Process.pid}"
# => child process. pid: 79602

# 子プロセスでの処理
sleep(1)
end

puts
"parent process. pid: #{Process.pid}, child pid: #{child_pid}"
# => parent process....
...pid: 79055, child pid: 79602

# 親プロセスでの処理
# ...

# 子プロセスの終了を待って終了。
Process.waitpid(child_pid)
//}


@see IO.popen,IO.pipe,Kernel.#at_exit,Kernel.#exit!, fork(2)...

Kernel.#fork { ... } -> Integer | nil (127.0)

fork(2) システムコールを使ってプロセスの複製を作 ります。親プロセスでは子プロセスのプロセスIDを、子プロセスでは nil を返します。ブロックを指定して呼び出した場合には、生成し た子プロセスでブロックを評価します。

...y]{
if child_pid = fork
puts
"parent process. pid: #{Process.pid}, child pid: #{child_pid}"
# => parent process. pid: 81060, child pid: 81329

# 親プロセスでの処理
# ...

# 子プロセスの終了を待って終了。
Process.waitpid(child_pid)
else
puts
"child process. pid:...
...ep(1)
end
//}

//emlist[ブロックを指定した場合][ruby]{
child_pid = fork do
puts
"child process. pid: #{Process.pid}"
# => child process. pid: 79602

# 子プロセスでの処理
sleep(1)
end

puts
"parent process. pid: #{Process.pid}, child pid: #{child_pid}"
# => parent process....
...pid: 79055, child pid: 79602

# 親プロセスでの処理
# ...

# 子プロセスの終了を待って終了。
Process.waitpid(child_pid)
//}


@see IO.popen,IO.pipe,Kernel.#at_exit,Kernel.#exit!, fork(2)...

Kernel.#sleep -> Integer (121.0)

sec 秒だけプログラムの実行を停止します。

...省略された場合、永久にスリープします。

@return 実際に停止していた秒数 (整数に丸められた値) です。

//emlist[例][ruby]{
it = Thread.new do
sleep
puts
'it_end'
end

re = sleep 2.11
puts
re
it.run
re2 = sleep 0.76
puts
re2
#=> 2
# it_end
# 1
//}...

Kernel.#sleep(sec) -> Integer (121.0)

sec 秒だけプログラムの実行を停止します。

...省略された場合、永久にスリープします。

@return 実際に停止していた秒数 (整数に丸められた値) です。

//emlist[例][ruby]{
it = Thread.new do
sleep
puts
'it_end'
end

re = sleep 2.11
puts
re
it.run
re2 = sleep 0.76
puts
re2
#=> 2
# it_end
# 1
//}...

Kernel.#test(cmd, file) -> bool | Time | Integer | nil (109.0)

単体のファイルでファイルテストを行います。

...: ?z
ファイルサイズが 0 である
: ?s
ファイルサイズが 0 でない (ファイルサイズを返す、0 ならば nil) -> Integer|nil
: ?f
ファイルはプレーンファイルである
: ?d
ファイルはディレクトリである
: ?l
ファイルはシン...

絞り込み条件を変える

Kernel.#test(cmd, file1, file2) -> bool (9.0)

2ファイル間のファイルテストを行います。

...イル1とファイル2が同一のファイルである

//emlist[例][ruby]{
IO.write("testfile1", "test1")
IO.write("testfile2", "test2")
%w(= < > -).each do |e|
result = test(e, "testfile1", "testfile2")
puts
"#{e}: #{result}"
end
//}

# => =: true
# => <: false
# => >: false
# => -: false...