るりまサーチ

最速Rubyリファレンスマニュアル検索!
253件ヒット [101-200件を表示] (0.037秒)
トップページ > モジュール:Kernel[x] > クエリ:[][x] > ライブラリ:ビルトイン[x]

別のキーワード

  1. _builtin []
  2. matrix []
  3. string []
  4. rake []
  5. fiddle []

キーワード

検索結果

<< < 1 2 3 > >>

Kernel.#exec(env, command, options={}) -> () (9.0)

引数で指定されたコマンドを実行します。

...場合、このメソッドからは戻りません。

=== 引数の解釈

この形式では command が shell のメタ文字
//emlist{
* ? {} [] <> () ~ & | \ $ ; ' ` " \n
//}
を含む場合、shell 経由で実行されます。
そうでなければインタプリタから直接実行さ...

Kernel.#readlines(rs = $/) -> [String] (9.0)

ARGFを Kernel.#gets(rs) でEOFまで読み込んで、その各行を要素としてもつ配列を返します。 行の区切りは引数 rs で指定した文字列になります。

...ARGFを Kernel.#gets(rs) でEOFまで読み込んで、その各行を要素としてもつ配列を返します。
行の区切りは引数 rs で指定した文字列になります。

rs に nil を指定すると行区切りなしとみなします。
空文字列 "" を指定すると連続...
...s("") #=> ["hello\nit\n\n", "common\n", "hello\nit\n\n", "common\n"]

ARGV << 'b.txt' << 'b.txt'
p readlines('it') #=> ["hello\nit", "\n\ncommon\n", "hello\nit", "\n\ncommon\n"]
p readlines #=> []
//}

//emlist[b.txt][ruby]{
hello
it

common
//}

@see $/,ARGF,Kernel.#gets, Kernel.#readline...

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

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

...た子プロセスのプロセスIDを返します。


=== 引数の解釈

この形式では command が shell のメタ文字
//emlist{
* ? {} [] <> () ~ & | \ $ ; ' ` " \n
//}
を含む場合、shell 経由で実行されます。
そうでなければインタプリタから直接実行さ...
...表す Hash
@param options オプションパラメータ Hash
@raise Errno::EXXX 起動に失敗し、ruby インタプリタに制御が戻った場合に発生します。

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


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

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

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

...た子プロセスのプロセスIDを返します。


=== 引数の解釈

この形式では command が shell のメタ文字
//emlist{
* ? {} [] <> () ~ & | \ $ ; ' ` " \n
//}
を含む場合、shell 経由で実行されます。
そうでなければインタプリタから直接実行さ...
...表す Hash
@param options オプションパラメータ Hash
@raise Errno::EXXX 起動に失敗し、ruby インタプリタに制御が戻った場合に発生します。

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


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

Kernel.#srand -> Integer (9.0)

Kernel.#rand や Random.rand で使用される擬似乱数生成器の種を設定し、古い種を返します。

...
Kernel
.#rand や Random.rand で使用される擬似乱数生成器の種を設定し、古い種を返します。

seed に整数を指定するとその絶対値を乱数の種に設定します。
それ以外の値を指定した場合は seed.to_int が指定されたものとして扱いま...
...す。
seed に既知の値を与えると、以前の Kernel.#rand の値を再現できます。

seed が省略された時には
現在の時刻やプロセス ID、srand を呼び出した回数、
また可能なら /dev/urandom から読み出したデータなどを元に種を作ります...
...@param seed 乱数の種となる整数を指定します。
Bignum も指定可能です。

//emlist[例][ruby]{
num = 455675
seeds = []

srand(num)

p rand(6) #=> 3
p rand(6) #=> 0
p rand(0) #=> 0.445804380918972
p rand(0) #=> 0.422248634121701

seeds << srand

p rand(6) #=> 3
p ran...

絞り込み条件を変える

Kernel.#srand(seed) -> Integer (9.0)

Kernel.#rand や Random.rand で使用される擬似乱数生成器の種を設定し、古い種を返します。

...
Kernel
.#rand や Random.rand で使用される擬似乱数生成器の種を設定し、古い種を返します。

seed に整数を指定するとその絶対値を乱数の種に設定します。
それ以外の値を指定した場合は seed.to_int が指定されたものとして扱いま...
...す。
seed に既知の値を与えると、以前の Kernel.#rand の値を再現できます。

seed が省略された時には
現在の時刻やプロセス ID、srand を呼び出した回数、
また可能なら /dev/urandom から読み出したデータなどを元に種を作ります...
...@param seed 乱数の種となる整数を指定します。
Bignum も指定可能です。

//emlist[例][ruby]{
num = 455675
seeds = []

srand(num)

p rand(6) #=> 3
p rand(6) #=> 0
p rand(0) #=> 0.445804380918972
p rand(0) #=> 0.422248634121701

seeds << srand

p rand(6) #=> 3
p ran...

Kernel.#system(command, options={}) -> bool | nil (9.0)

引数を外部コマンドとして実行して、成功した時に真を返します。

...普通
$? を参照することで判別可能です。

=== 引数の解釈

この形式では command が shell のメタ文字
//emlist{
* ? {} [] <> () ~ & | \ $ ; ' ` " \n
//}
を含む場合、shell 経由で実行されます。
そうでなければインタプリタから直接実行さ...
...文字列で指定します。
@param env 更新する環境変数を表す Hash
@param options オプションパラメータ Hash

//emlist[シェル経由でコマンドを実行][ruby]{
system("echo *") # => true
# fileA fileB fileC ...
//}


@see Kernel.#`,Kernel.#spawn,Kernel.#exec,system(3)...
...# => Errno::ENOENT (No such file or directory - sad)
system('ruby -e "exit(false)"', exception: true) # => RuntimeError (Command failed with exit 1: ruby -e "exit(false)")
system('ruby -e "exit(true)"', exception: true) # => true
//}

@see Kernel.#`,Kernel.#spawn,Kernel.#exec,system(3)...

Kernel.#system(env, command, options={}) -> bool | nil (9.0)

引数を外部コマンドとして実行して、成功した時に真を返します。

...普通
$? を参照することで判別可能です。

=== 引数の解釈

この形式では command が shell のメタ文字
//emlist{
* ? {} [] <> () ~ & | \ $ ; ' ` " \n
//}
を含む場合、shell 経由で実行されます。
そうでなければインタプリタから直接実行さ...
...文字列で指定します。
@param env 更新する環境変数を表す Hash
@param options オプションパラメータ Hash

//emlist[シェル経由でコマンドを実行][ruby]{
system("echo *") # => true
# fileA fileB fileC ...
//}


@see Kernel.#`,Kernel.#spawn,Kernel.#exec,system(3)...
...# => Errno::ENOENT (No such file or directory - sad)
system('ruby -e "exit(false)"', exception: true) # => RuntimeError (Command failed with exit 1: ruby -e "exit(false)")
system('ruby -e "exit(true)"', exception: true) # => true
//}

@see Kernel.#`,Kernel.#spawn,Kernel.#exec,system(3)...

Kernel.#exec(env, program, *args, options={}) -> () (4.0)

引数で指定されたコマンドを実行します。

...イルデスクリプタなど)引き継ぎます。
Hash を options として渡すことで、この挙動を変更できます。
詳しくは Kernel.#spawn を参照してください。

=== 引数の解釈

この形式で呼び出した場合、空白や shell のメタキャラクタも
...
...替えて以下を実行
$ ps aux|grep sleep
xxxx 32754 0.0 0.0 2580 468 pts/3 S+ 22:01 0:00 mysleep 600
xxxx 32761 0.0 0.0 2824 792 pts/6 S+ 22:01 0:00 grep sleep

@see Kernel.#system,Kernel.#`,Kernel.#spawn,Kernel.#fork,IO.popen,IO.pipe,Kernel.#open,exec(3)...

Kernel.#exec(program, *args, options={}) -> () (4.0)

引数で指定されたコマンドを実行します。

...イルデスクリプタなど)引き継ぎます。
Hash を options として渡すことで、この挙動を変更できます。
詳しくは Kernel.#spawn を参照してください。

=== 引数の解釈

この形式で呼び出した場合、空白や shell のメタキャラクタも
...
...替えて以下を実行
$ ps aux|grep sleep
xxxx 32754 0.0 0.0 2580 468 pts/3 S+ 22:01 0:00 mysleep 600
xxxx 32761 0.0 0.0 2824 792 pts/6 S+ 22:01 0:00 grep sleep

@see Kernel.#system,Kernel.#`,Kernel.#spawn,Kernel.#fork,IO.popen,IO.pipe,Kernel.#open,exec(3)...

絞り込み条件を変える

<< < 1 2 3 > >>