るりまサーチ

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

別のキーワード

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

ライブラリ

キーワード

検索結果

<< 1 2 > >>

Kernel.#Integer(arg, base = 0) -> Integer (18384.0)

引数を整数 (Fixnum,Bignum) に変換した結果を返します。

...数) です。


@raise ArgumentError 整数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError メソッド to_int, to_i を持たないオブジェクトを引数に指定したか、to_int, to_i
が整数(Integerのサブクラス)を返さ...
...発生します。
@raise TypeError 引数に nil を指定した場合に発生します。

//emlist[例][ruby]{
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9

p Integer(nil) # can't convert nil into Integer (TypeError)
p Integer(Object.new) # cannot...
...convert Object into Integer (TypeError)

p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10") #=> 10
p Integer("010") #=> 8
p Integer("0o10") #=> 8
p Integer("0x10") #=> 16
p Integer("0b10") #=> 2
p Integer(" \n10\t ") #=> 10 # 先頭と末尾の空白類...

Kernel.#Integer(arg, base = 0, exception: true) -> Integer | nil (18384.0)

引数を整数 (Fixnum,Bignum) に変換した結果を返します。

...に nil を返します。

@raise ArgumentError 整数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError メソッド to_int, to_i を持たないオブジェクトを引数に指定したか、to_int, to_i
が整数(Integerのサブクラス)を返さ...
...発生します。
@raise TypeError 引数に nil を指定した場合に発生します。

//emlist[例][ruby]{
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9

p Integer(nil) # can't convert nil into Integer (TypeError)
p Integer(Object.new) # cannot...
...convert Object into Integer (TypeError)

p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10") #=> 10
p Integer("010") #=> 8
p Integer("0o10") #=> 8
p Integer("0x10") #=> 16
p Integer("0b10") #=> 2
p Integer(" \n10\t ") #=> 10 # 先頭と末尾の空白類...

Kernel.#spawn(env, program, *args, options={}) -> Integer (223.0)

引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。

...名文字列、Hash の値に設定する値とします。
nil とすることで環境変数が削除(unsetenv(3))されます。
//emlist[例][ruby]{
# FOO を BAR にして BAZ を削除する
pid = spawn({"FOO"=>"BAR", "BAZ"=>nil}, command)
//}

親プロセスは Process.#waitpid で子プロ...
...します。
//emlist[][ruby]{
# すべての環境変数をクリア
pid = spawn(command, :unsetenv_others=>true)
# FOO だけ
pid = spawn({"FOO"=>"BAR"}, command, :unsetenv_others=>true)
//}

「:pgroup」でプロセスグループを指定できます。
//emlist[][ruby]{
# true, 0 で新しい...
...2つの配列、を渡すことができます。
それぞれ Process.#setrlimit の引数が2個、3個の場合に対応します。
//emlist[][ruby]{
# 現プロセスの core の resource limit を取得
cur, max = Process.getrlimit(:CORE)
# 一時的に子プロセスの core dump を止める...
...din), 1(stdout), 2(stderr) 以外の
ファイルデスクリプタをすべて閉じます。
false がデフォルトです。

: :exception
Kernel
.#system のみで指定できます。
これを true に設定すると、nil や false を返す代わりに例外が発生します。
fa...

Kernel.#spawn(program, *args) -> Integer (223.0)

引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。

...名文字列、Hash の値に設定する値とします。
nil とすることで環境変数が削除(unsetenv(3))されます。
//emlist[例][ruby]{
# FOO を BAR にして BAZ を削除する
pid = spawn({"FOO"=>"BAR", "BAZ"=>nil}, command)
//}

親プロセスは Process.#waitpid で子プロ...
...します。
//emlist[][ruby]{
# すべての環境変数をクリア
pid = spawn(command, :unsetenv_others=>true)
# FOO だけ
pid = spawn({"FOO"=>"BAR"}, command, :unsetenv_others=>true)
//}

「:pgroup」でプロセスグループを指定できます。
//emlist[][ruby]{
# true, 0 で新しい...
...2つの配列、を渡すことができます。
それぞれ Process.#setrlimit の引数が2個、3個の場合に対応します。
//emlist[][ruby]{
# 現プロセスの core の resource limit を取得
cur, max = Process.getrlimit(:CORE)
# 一時的に子プロセスの core dump を止める...
...din), 1(stdout), 2(stderr) 以外の
ファイルデスクリプタをすべて閉じます。
false がデフォルトです。

: :exception
Kernel
.#system のみで指定できます。
これを true に設定すると、nil や false を返す代わりに例外が発生します。
fa...

Kernel.#spawn(command, options={}) -> Integer (143.0)

引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。

...表す Hash
@param options オプションパラメータ Hash
@raise Errno::EXXX 起動に失敗し、ruby インタプリタに制御が戻った場合に発生します。

@raise Errno::EXXX コマンドが実行できなかった場合に発生します。


@see Kernel.#system,Kernel.#exec...

絞り込み条件を変える

Kernel.#spawn(env, command, options={}) -> Integer (143.0)

引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。

...表す Hash
@param options オプションパラメータ Hash
@raise Errno::EXXX 起動に失敗し、ruby インタプリタに制御が戻った場合に発生します。

@raise Errno::EXXX コマンドが実行できなかった場合に発生します。


@see Kernel.#system,Kernel.#exec...

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

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

...す。

fork 前に STDOUT と STDERR を IO#flush します。

@raise NotImplementedError 実行環境がこのメソッドに対応していないとき発生します。

//emlist[ブロックを指定しなかった場合][ruby]{
if child_pid = fork
puts "parent process. pid: #{Process.pid},...
...: #{Process.pid}"
# => child process. pid: 81329

# 子プロセスでの処理
sleep(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 (122.0)

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

...す。

fork 前に STDOUT と STDERR を IO#flush します。

@raise NotImplementedError 実行環境がこのメソッドに対応していないとき発生します。

//emlist[ブロックを指定しなかった場合][ruby]{
if child_pid = fork
puts "parent process. pid: #{Process.pid},...
...: #{Process.pid}"
# => child process. pid: 81329

# 子プロセスでの処理
sleep(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.#syscall(num, *arg) -> Integer (121.0)

numで指定された番号のシステムコールを実行します。 第2引数以降をシステムコールの引数として渡します。

...大 9 個まで渡すことができます。
@raise Errno::EXXX syscall(2) が -1 を返した場合に発生します。
@raise NotImplementedError 実行環境がこのメソッドに対応していないとき発生します。

//emlist[例][ruby]{
syscall 4, 1, "hello\n", 6 # '4' is write(2)...

Kernel.#Rational(x, y = 1) -> Rational (44.0)

引数を有理数(Rational)に変換した結果を返します。

...ジェクトを作成します。


@raise ArgumentError 変換できないオブジェクトを指定した場合に発生します。

引数 x、y の両方を指定した場合、x/y した Rational オブジェクトを
返します。

//emlist[例][ruby]{
Rational("1/3") # => (1/3)...
...なり、Rational オブジェクトは常に既約(それ以上
約分できない状態)である事に注意してください。

//emlist[例][ruby]{
Rational(2, 6) # => (1/3)
Rational(1, 3) * 3 # => (1/1)
//}

引数に文字列を指定する場合、以下のいずれかの形式...
...数にする事も可能ですが、分母には指定できませ
ん。また、Kernel.#Integer とは違い "0x10" のような進数を表す接頭
辞を含めた指定は行えません。

//emlist[例][ruby]{
Rational("1/3") # => (1/3)
Rational("0.3") # => (3/10)
Rational('0.3E...

絞り込み条件を変える

<< 1 2 > >>