るりまサーチ

最速Rubyリファレンスマニュアル検索!
1097件ヒット [101-200件を表示] (0.190秒)

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

キーワード

検索結果

<< < 1 2 3 4 ... > >>

IO#clone -> IO (8002.0)

レシーバと同じ IO を参照する新しい IO オブジェクトを返します。 参照しているファイル記述子は dup(2) されます。

...シーバと同じ IO を参照する新しい IO オブジェクトを返します。
参照しているファイル記述子は dup(2) されます。

clone の際に self は一旦 IO#flush されます。
フリーズした IO の clone は同様にフリーズされた IO を返しますが、...
...しいフリーズされていない IO を返します。

@raise IOError 既に close されていた場合に発生します。

//emlist[例][ruby]{
clone_io = nil
IO
.write("testfile", "test")
File.open("testfile") do |io|
clone_io = io.clone
end
clone_io.read # => "test"
clone_io.close
//}...

IO#close -> nil (8002.0)

入出力ポートをクローズします。

...ポートをクローズします。

以後このポートに対して入出力を行うと例外 IOError が発生しま
す。ガーベージコレクトの際にはクローズされていない IO ポートはクロー
ズされます。
self がパイプでプロセスにつながっていれ...
...@raise IOError 既に close されていた場合に発生します。

//emlist[例][ruby]{
IO
.write("testfile", "test")
f = File.open("testfile")
f.read # => "test"
f.close
# f.read # => IOError (すでに close しているので read できない)
//}

@see IO#closed?, IO#close_read, IO#close...
...se Errno::EXXX close に失敗した場合に発生します。

//emlist[例][ruby]{
IO
.write("testfile", "test")
f = File.open("testfile")
f.read # => "test"
f.close
# f.read # => IOError (すでに close しているので read できない)
//}

@see IO#closed?, IO#close_read, IO#close_write...

IO#close_on_exec=(bool) (8002.0)

自身に close-on-exec フラグを設定します。

...2)
@param bool 自身の close-on-exec フラグを true か false で指定します。

f = open("/dev/null")
f.close_on_exec = true
system("cat", "/proc/self/fd/#{f.fileno}") # cat: /proc/self/fd/3: No such file or directory
f.closed? #=> false

@see IO#close_on_exec?...

IO#close_on_exec? -> bool (8002.0)

自身に close-on-exec フラグが設定されていた場合 true を返します。 そうでない場合に false を返します。

...ます。
そうでない場合に false を返します。

f = open("/dev/null")
f.close_on_exec? #=> true
f.close_on_exec = false
f.close_on_exec? #=> false
f.close_on_exec = true
f.close_on_exec? #=> true

@see IO#close_on_exec=...

IO#close_read -> nil (8002.0)

読み込み用の IO を close します。主にパイプや読み書き両用に作成し た IO オブジェクトで使用します。

...読み込み用の IO を close します。主にパイプや読み書き両用に作成し
IO オブジェクトで使用します。


@raise IOError 自身が読み込み用にオープンされていなければ発生します。

@raise Errno::EXXX close に失敗した場合に発生し...
...ます。

//emlist[例][ruby]{
IO
.popen("/bin/sh","r+") do |f|
f.close_read
# f.readlines # => IOError: not opened for reading
end
//}

@see IO#close, IO#closed?, IO#close_write...
...読み込み用の IO を close します。主にパイプや読み書き両用に作成し
IO オブジェクトで使用します。

既に close されていた場合には単に無視されます。

@raise IOError 自身が読み込み用にオープンされていなければ発生し...
...ます。

@raise Errno::EXXX close に失敗した場合に発生します。

//emlist[例][ruby]{
IO
.popen("/bin/sh","r+") do |f|
f.close_read
# f.readlines # => IOError: not opened for reading
end
//}

@see IO#close, IO#closed?, IO#close_write...

絞り込み条件を変える

IO#close_write -> nil (8002.0)

書き込み用の IO を close します。

... IO を close します。


@raise IOError 自身が書き込み用にオープンされていなければ発生します。

@raise Errno::EXXX close に失敗した場合に発生します。

//emlist[例][ruby]{
f = IO.popen("/bin/sh","r+") do |f|
f.close_write
# f.print "nowhere" # => IOEr...
...ror: not opened for writing
end
//}

@see IO#close, IO#closed?, IO#close_read...
... IO を close します。

既に close されていた場合には単に無視されます。

@raise IOError 自身が書き込み用にオープンされていなければ発生します。

@raise Errno::EXXX close に失敗した場合に発生します。

//emlist[例][ruby]{
f = IO.popen...
...("/bin/sh","r+") do |f|
f.close_write
# f.print "nowhere" # => IOError: not opened for writing
end
//}

@see IO#close, IO#closed?, IO#close_read...

IO#closed? -> bool (8002.0)

self が完全に(読み込み用と書き込み用の両方が)クローズされている場合に true を返します。 そうでない場合は false を返します。

...t[例][ruby]{
IO
.write("testfile", "test")
f = File.new("testfile")
f.close # => nil
f.closed? # => true
f = IO.popen("/bin/sh","r+")
f.close_write # => nil
f.closed? # => false
f.close_read # => nil
f.closed? # => true
//}

@see IO#close, IO#close_read, IO#close_write...

IO#codepoints -> Enumerator (8002.0)

このメソッドは obsolete です。 代わりに IO#each_codepoint を使用してください。

...このメソッドは obsolete です。
代わりに IO#each_codepoint を使用してください。

使用すると警告メッセージが表示されます。

IO
の各コードポイントに対して繰り返しブロックを呼びだします。

ブロックの引数にはコードポ...
...イントを表す整数が渡されます。

ブロックを省略した場合には、Enumerator を返します。


@see IO#each_codepoint...

IO#codepoints {|c| ... } -> self (8002.0)

このメソッドは obsolete です。 代わりに IO#each_codepoint を使用してください。

...このメソッドは obsolete です。
代わりに IO#each_codepoint を使用してください。

使用すると警告メッセージが表示されます。

IO
の各コードポイントに対して繰り返しブロックを呼びだします。

ブロックの引数にはコードポ...
...イントを表す整数が渡されます。

ブロックを省略した場合には、Enumerator を返します。


@see IO#each_codepoint...

IO#dup -> IO (8002.0)

レシーバと同じ IO を参照する新しい IO オブジェクトを返します。 参照しているファイル記述子は dup(2) されます。

...シーバと同じ IO を参照する新しい IO オブジェクトを返します。
参照しているファイル記述子は dup(2) されます。

clone の際に self は一旦 IO#flush されます。
フリーズした IO の clone は同様にフリーズされた IO を返しますが、...
...しいフリーズされていない IO を返します。

@raise IOError 既に close されていた場合に発生します。

//emlist[例][ruby]{
clone_io = nil
IO
.write("testfile", "test")
File.open("testfile") do |io|
clone_io = io.clone
end
clone_io.read # => "test"
clone_io.close
//}...

絞り込み条件を変える

IO#each(limit) -> Enumerator (8002.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...
IO
の現在位置から 1 行ずつ文字列として読み込み、それを引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。

テキスト読み込みメソ...
...(パラグラフモード)。
@param limit 最大の読み込みバイト数

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

//emlist[例: 引数なし][ruby]{
IO
.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so o...
...is is line three,\n"
# "4: And so on..."
//}
//emlist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO
.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lin...

IO#each(limit) {|line| ... } -> self (8002.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...
IO
の現在位置から 1 行ずつ文字列として読み込み、それを引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。

テキスト読み込みメソ...
...(パラグラフモード)。
@param limit 最大の読み込みバイト数

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

//emlist[例: 引数なし][ruby]{
IO
.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so o...
...is is line three,\n"
# "4: And so on..."
//}
//emlist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO
.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lin...
<< < 1 2 3 4 ... > >>