るりまサーチ

最速Rubyリファレンスマニュアル検索!
209件ヒット [101-200件を表示] (0.034秒)
トップページ > クエリ:kernel[x] > クエリ:open[x] > クエリ:print[x] > 種類:特異メソッド[x]

別のキーワード

  1. kernel spawn
  2. kernel exec
  3. kernel system
  4. kernel open
  5. kernel fail

ライブラリ

クラス

キーワード

検索結果

<< < 1 2 3 > >>

IO.popen(env = {}, [cmdname, *args, execopt={}], mode = "r", opt={}) {|f| ... } -> object (6135.0)

サブプロセスを実行し、そのプロセスの標準入出力 との間にパイプラインを確立します。生成したパイプを IO オブジェクトとして返します。

...入出力
との間にパイプラインを確立します。生成したパイプを IO オブジェクトとして返します。

p io = IO.popen("cat", "r+") # => #<IO:fd 4>
io.puts "foo"
io.close_write
p io.gets # => "foo\n"

サブプロセスを指定する方法...
...ブロックの実行結果を返します。ブロックの実行後、生成したパイ
プは自動的にクローズされます。

p IO.popen("cat", "r+") {|io|
io.puts "foo"
io.close_write
io.gets
}
# => "foo\n"


opt でプロセス起動のためのオプションや、...
...のためのオプションは Kernel.#spawn と、
パイプオブジェクトの属性の指定のオプションは IO.new と共通です。
つまり、 :external_encoding や :unsetenv_others が指定できます。
オプションの詳しい意味は Kernel.#spawn や IO.new を参照して...

IO.popen(env = {}, command, mode = "r", opt={}) -> IO (6135.0)

サブプロセスを実行し、そのプロセスの標準入出力 との間にパイプラインを確立します。生成したパイプを IO オブジェクトとして返します。

...入出力
との間にパイプラインを確立します。生成したパイプを IO オブジェクトとして返します。

p io = IO.popen("cat", "r+") # => #<IO:fd 4>
io.puts "foo"
io.close_write
p io.gets # => "foo\n"

サブプロセスを指定する方法...
...ブロックの実行結果を返します。ブロックの実行後、生成したパイ
プは自動的にクローズされます。

p IO.popen("cat", "r+") {|io|
io.puts "foo"
io.close_write
io.gets
}
# => "foo\n"


opt でプロセス起動のためのオプションや、...
...のためのオプションは Kernel.#spawn と、
パイプオブジェクトの属性の指定のオプションは IO.new と共通です。
つまり、 :external_encoding や :unsetenv_others が指定できます。
オプションの詳しい意味は Kernel.#spawn や IO.new を参照して...

IO.popen(env = {}, command, mode = "r", opt={}) {|f| ... } -> object (6135.0)

サブプロセスを実行し、そのプロセスの標準入出力 との間にパイプラインを確立します。生成したパイプを IO オブジェクトとして返します。

...入出力
との間にパイプラインを確立します。生成したパイプを IO オブジェクトとして返します。

p io = IO.popen("cat", "r+") # => #<IO:fd 4>
io.puts "foo"
io.close_write
p io.gets # => "foo\n"

サブプロセスを指定する方法...
...ブロックの実行結果を返します。ブロックの実行後、生成したパイ
プは自動的にクローズされます。

p IO.popen("cat", "r+") {|io|
io.puts "foo"
io.close_write
io.gets
}
# => "foo\n"


opt でプロセス起動のためのオプションや、...
...のためのオプションは Kernel.#spawn と、
パイプオブジェクトの属性の指定のオプションは IO.new と共通です。
つまり、 :external_encoding や :unsetenv_others が指定できます。
オプションの詳しい意味は Kernel.#spawn や IO.new を参照して...

IO.popen("-", mode = "r", opt={}) -> IO (6130.0)

第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。

...を返し、子プロセスでは
nil を返します。

io = IO.popen("-", "r+")
if io # parent
io.puts "foo"
p io.gets # => "child output: foo\n"
io.close
else # child
s = gets
print
"child output: " + s
exit
end

ブロックを与えられ...
...たパイ
プは自動的にクローズされます。
子プロセスでは nil を引数にブロックを実行し終了します。

p IO.popen("-", "r+") {|io|
if io # parent
io.puts "foo"
io.gets
else # child
s = gets
puts "child output: " + s
end...
... Kernel.#spawn で指定できるものと共通なので
詳しくはそちらを見てください。

@param env 環境変数を { 変数名 => 内容 } という形式の Hash で渡します。
@param mode オープンする IO ポートのモードを指定します。mode の詳細は Kernel....

IO.popen("-", mode = "r", opt={}) {|io| ... } -> object (6130.0)

第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。

...を返し、子プロセスでは
nil を返します。

io = IO.popen("-", "r+")
if io # parent
io.puts "foo"
p io.gets # => "child output: foo\n"
io.close
else # child
s = gets
print
"child output: " + s
exit
end

ブロックを与えられ...
...たパイ
プは自動的にクローズされます。
子プロセスでは nil を引数にブロックを実行し終了します。

p IO.popen("-", "r+") {|io|
if io # parent
io.puts "foo"
io.gets
else # child
s = gets
puts "child output: " + s
end...
... Kernel.#spawn で指定できるものと共通なので
詳しくはそちらを見てください。

@param env 環境変数を { 変数名 => 内容 } という形式の Hash で渡します。
@param mode オープンする IO ポートのモードを指定します。mode の詳細は Kernel....

絞り込み条件を変える

IO.popen(env, "-", mode = "r", opt={}) -> IO (6130.0)

第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。

...を返し、子プロセスでは
nil を返します。

io = IO.popen("-", "r+")
if io # parent
io.puts "foo"
p io.gets # => "child output: foo\n"
io.close
else # child
s = gets
print
"child output: " + s
exit
end

ブロックを与えられ...
...たパイ
プは自動的にクローズされます。
子プロセスでは nil を引数にブロックを実行し終了します。

p IO.popen("-", "r+") {|io|
if io # parent
io.puts "foo"
io.gets
else # child
s = gets
puts "child output: " + s
end...
... Kernel.#spawn で指定できるものと共通なので
詳しくはそちらを見てください。

@param env 環境変数を { 変数名 => 内容 } という形式の Hash で渡します。
@param mode オープンする IO ポートのモードを指定します。mode の詳細は Kernel....

IO.popen(env, "-", mode = "r", opt={}) {|io| ... } -> object (6130.0)

第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。

...を返し、子プロセスでは
nil を返します。

io = IO.popen("-", "r+")
if io # parent
io.puts "foo"
p io.gets # => "child output: foo\n"
io.close
else # child
s = gets
print
"child output: " + s
exit
end

ブロックを与えられ...
...たパイ
プは自動的にクローズされます。
子プロセスでは nil を引数にブロックを実行し終了します。

p IO.popen("-", "r+") {|io|
if io # parent
io.puts "foo"
io.gets
else # child
s = gets
puts "child output: " + s
end...
... Kernel.#spawn で指定できるものと共通なので
詳しくはそちらを見てください。

@param env 環境変数を { 変数名 => 内容 } という形式の Hash で渡します。
@param mode オープンする IO ポートのモードを指定します。mode の詳細は Kernel....

File.new(path, mode = "r", perm = 0666) -> File (63.0)

path で指定されるファイルをオープンし、File オブジェクトを生成して 返します。

...整数の場合はファイルディスクリプタとして扱い、それに対応する
File オブジェクトを生成して返します。IO.open と同じです。
ブロックを指定して呼び出した場合は、File オブジェクトを引数として
ブロックを実行します。...
...am mode モードを文字列か定数の論理和で指定します。Kernel.#open と同じです。

@param perm ファイルを生成する場合のファイルのパーミッションを整数で指定します。Kernel.#open と同じです。

@raise Errno::EXXX ファイルのオープンに...
...st[例: File.open による読み込みモードでのファイルオープン][ruby]{
f = File.open("testfile", "r")
f.class # => File
f.close
//}

//emlist[例: File.open による書き込みモードでのファイルオープン][ruby]{
File.open("testfile", "w", 0755) { |f| f.print "test" }
Fi...

IO.foreach(path, rs = $/, chomp: false) -> Enumerator (25.0)

path で指定されたファイルの各行を引数としてブロックを繰り返し実行します。 path のオープンに成功すれば nil を返します。

...

テキスト読み込みメソッドとして動作します。

path が空ファイルの場合、何もせずに nil を返します。
Kernel
.#open と同様 path の先頭が "|" ならば、"|" に続くコマンドの出力を読み取ります。

@param path ファイル名を表す文...
...by]{
IO.write("testfile", "line1\nline2,\nline3\n")
IO.foreach("testfile") # => #<Enumerator: IO:foreach("testfile")>
IO.foreach("testfile") { |x| print "GOT ", x }
# => GOT line1
# GOT line2,
# GOT line3
//}

//emlist[例:カンマを行の区切りに指定( rs = "," )][ruby]{
IO.write("testf...
...line1,
# GOT line2,
# GOT line3
//}

//emlist[例: 各行の末尾から "\n", "\r", または "\r\n" を取り除く(chomp = true)][ruby]{
IO.write("testfile", "line1\nline2,\nline3\n")
IO.foreach("testfile", chomp: true) { |x| print "GOT ", x }
# => GOT line1GOT line2,GOT line3
//}

@see $/...

IO.foreach(path, rs = $/, chomp: false) {|line| ... } -> nil (25.0)

path で指定されたファイルの各行を引数としてブロックを繰り返し実行します。 path のオープンに成功すれば nil を返します。

...

テキスト読み込みメソッドとして動作します。

path が空ファイルの場合、何もせずに nil を返します。
Kernel
.#open と同様 path の先頭が "|" ならば、"|" に続くコマンドの出力を読み取ります。

@param path ファイル名を表す文...
...by]{
IO.write("testfile", "line1\nline2,\nline3\n")
IO.foreach("testfile") # => #<Enumerator: IO:foreach("testfile")>
IO.foreach("testfile") { |x| print "GOT ", x }
# => GOT line1
# GOT line2,
# GOT line3
//}

//emlist[例:カンマを行の区切りに指定( rs = "," )][ruby]{
IO.write("testf...
...line1,
# GOT line2,
# GOT line3
//}

//emlist[例: 各行の末尾から "\n", "\r", または "\r\n" を取り除く(chomp = true)][ruby]{
IO.write("testfile", "line1\nline2,\nline3\n")
IO.foreach("testfile", chomp: true) { |x| print "GOT ", x }
# => GOT line1GOT line2,GOT line3
//}

@see $/...

絞り込み条件を変える

<< < 1 2 3 > >>