910件ヒット
[1-100件を表示]
(0.050秒)
種類
- インスタンスメソッド (789)
- 特異メソッド (121)
ライブラリ
- ビルトイン (899)
-
io
/ console (11)
キーワード
- advise (11)
- clone (11)
- close (11)
-
close
_ on _ exec= (11) - closed? (11)
- console (11)
- dup (11)
- each (66)
-
each
_ byte (22) -
each
_ char (22) -
each
_ codepoint (22) -
each
_ line (66) - eof (11)
- eof? (11)
-
external
_ encoding (11) - fcntl (11)
- fdatasync (11)
- fileno (11)
- flush (11)
-
for
_ fd (11) - getbyte (11)
- getc (11)
- gets (33)
-
internal
_ encoding (11) - isatty (11)
- lineno (11)
- lineno= (11)
- new (11)
- open (22)
- pos (11)
- pos= (11)
- pread (7)
- pwrite (7)
- read (44)
- readbyte (11)
- readchar (11)
- readline (33)
- readlines (66)
- reopen (33)
- rewind (11)
- seek (11)
-
set
_ encoding (33) -
set
_ encoding _ by _ bom (5) - stat (11)
- sync (11)
- sysread (11)
- sysseek (11)
- syswrite (11)
- tell (11)
-
to
_ i (11) - tty? (11)
- ungetbyte (11)
- ungetc (11)
- write (11)
検索結果
先頭5件
-
IO
# fileno -> Integer (6101.0) -
ファイル記述子を表す整数を返します。
...ファイル記述子を表す整数を返します。
@raise IOError 既に close されている場合に発生します。
//emlist[例][ruby]{
$stdin.fileno # => 0
$stdout.fileno # => 1
//}......ファイル記述子を表す整数を返します。
@raise IOError 既に close されている場合に発生します。
//emlist[例][ruby]{
$stdin.fileno # => 0
$stdout.fileno # => 1
//}
@see Dir#fileno... -
IO
# to _ i -> Integer (3001.0) -
ファイル記述子を表す整数を返します。
...ファイル記述子を表す整数を返します。
@raise IOError 既に close されている場合に発生します。
//emlist[例][ruby]{
$stdin.fileno # => 0
$stdout.fileno # => 1
//}......ファイル記述子を表す整数を返します。
@raise IOError 既に close されている場合に発生します。
//emlist[例][ruby]{
$stdin.fileno # => 0
$stdout.fileno # => 1
//}
@see Dir#fileno... -
IO
# stat -> File :: Stat (142.0) -
ファイルのステータスを含む File::Stat オブジェクトを生成して 返します。
...タスを含む File::Stat オブジェクトを生成して
返します。
@raise Errno::EXXX ステータスの読み込みに失敗した場合に発生します。
@raise IOError 既に close されていた場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "This is line......one\nThis is line two\n")
File.open("testfile") do |f|
s = f.stat
"%o" % s.mode # => "100644"
s.blksize # => 4096
s.atime # => 2018-03-01 23:19:59 +0900
end
//}
@see File#lstat, File.stat, File.lstat... -
IO
. console -> File | nil (124.0) -
端末を File オブジェクトで返します。
...端末を File オブジェクトで返します。
require "io/console"
IO.console # => #<File:/dev/tty>
プロセスが端末から切り離された状態で実行すると nil を返します。
戻り値はプラットフォームや環境に依存します。... -
IO
# readlines(limit , chomp: false) -> [String] (31.0) -
データを全て読み込んで、その各行を要素としてもつ配列を返します。 既に EOF に達していれば空配列 [] を返します。
...す。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例][ruby]{
IO.write("testfile", "line1,\nline2,\nline3,\n")
File.open("testfile") { |f| p f.readlines } # => ["line1,\n", "line2,\n", "line3,\n"]
File.open("testfile") { |f| p f.r......n", "e2,", "\n", "lin", "e3,", "\n"]
File.open("testfile") { |f| p f.readlines(",") } # => ["line1,", "\nline2,", "\nline3,", "\n"]
//}
//emlist[例: rsを取り除く(chomp = true)][ruby]{
IO.write("testfile", "line1,\rline2,\r\nline3,\n")
File.open("testfile") { |f| p f.readlines(chomp: true)......} # => ["line1,\rline2,", "line3,"]
File.open("testfile") { |f| p f.readlines("\r", chomp: true) } # => ["line1,", "line2,", "\nline3,\n"]
//}
@see $/, IO#gets... -
IO
# readlines(rs = $ / , chomp: false) -> [String] (31.0) -
データを全て読み込んで、その各行を要素としてもつ配列を返します。 既に EOF に達していれば空配列 [] を返します。
...す。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例][ruby]{
IO.write("testfile", "line1,\nline2,\nline3,\n")
File.open("testfile") { |f| p f.readlines } # => ["line1,\n", "line2,\n", "line3,\n"]
File.open("testfile") { |f| p f.r......n", "e2,", "\n", "lin", "e3,", "\n"]
File.open("testfile") { |f| p f.readlines(",") } # => ["line1,", "\nline2,", "\nline3,", "\n"]
//}
//emlist[例: rsを取り除く(chomp = true)][ruby]{
IO.write("testfile", "line1,\rline2,\r\nline3,\n")
File.open("testfile") { |f| p f.readlines(chomp: true)......} # => ["line1,\rline2,", "line3,"]
File.open("testfile") { |f| p f.readlines("\r", chomp: true) } # => ["line1,", "line2,", "\nline3,\n"]
//}
@see $/, IO#gets... -
IO
# readlines(rs , limit , chomp: false) -> [String] (31.0) -
データを全て読み込んで、その各行を要素としてもつ配列を返します。 既に EOF に達していれば空配列 [] を返します。
...す。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例][ruby]{
IO.write("testfile", "line1,\nline2,\nline3,\n")
File.open("testfile") { |f| p f.readlines } # => ["line1,\n", "line2,\n", "line3,\n"]
File.open("testfile") { |f| p f.r......n", "e2,", "\n", "lin", "e3,", "\n"]
File.open("testfile") { |f| p f.readlines(",") } # => ["line1,", "\nline2,", "\nline3,", "\n"]
//}
//emlist[例: rsを取り除く(chomp = true)][ruby]{
IO.write("testfile", "line1,\rline2,\r\nline3,\n")
File.open("testfile") { |f| p f.readlines(chomp: true)......} # => ["line1,\rline2,", "line3,"]
File.open("testfile") { |f| p f.readlines("\r", chomp: true) } # => ["line1,", "line2,", "\nline3,\n"]
//}
@see $/, IO#gets... -
IO
. read(path , **opt) -> String | nil (31.0) -
path で指定されたファイルを offset 位置から length バイト分読み込んで返します。
...場合は nil を返します。ただし、length に nil か 0 が指定されている場合は、空文字列 "" を返します。例えば、IO.read(空ファイル) は "" を返します。
引数 length が指定された場合はバイナリ読み込みメソッド、そうでない場合......e
IO.open のモードを指定します。
"r" で始まる文字列である必要があります。
: :open_args
IO.open に渡される引数を配列で指定します。
これらの他、 :external_encoding など
IO.open のオプション引数が指定できます。
@see IO.......binread
例:
IO.read(empty_file) #=> ""
IO.read(empty_file, 1) #=> nil
IO.read(one_byte_file, 0, 10) #=> ""
IO.read(one_byte_file, nil, 10) #=> ""
IO.read(one_byte_file, 1, 10) #=> nil... -
IO
. read(path , length = nil , **opt) -> String | nil (31.0) -
path で指定されたファイルを offset 位置から length バイト分読み込んで返します。
...場合は nil を返します。ただし、length に nil か 0 が指定されている場合は、空文字列 "" を返します。例えば、IO.read(空ファイル) は "" を返します。
引数 length が指定された場合はバイナリ読み込みメソッド、そうでない場合......e
IO.open のモードを指定します。
"r" で始まる文字列である必要があります。
: :open_args
IO.open に渡される引数を配列で指定します。
これらの他、 :external_encoding など
IO.open のオプション引数が指定できます。
@see IO.......binread
例:
IO.read(empty_file) #=> ""
IO.read(empty_file, 1) #=> nil
IO.read(one_byte_file, 0, 10) #=> ""
IO.read(one_byte_file, nil, 10) #=> ""
IO.read(one_byte_file, 1, 10) #=> nil... -
IO
. read(path , length = nil , offset = 0 , **opt) -> String | nil (31.0) -
path で指定されたファイルを offset 位置から length バイト分読み込んで返します。
...場合は nil を返します。ただし、length に nil か 0 が指定されている場合は、空文字列 "" を返します。例えば、IO.read(空ファイル) は "" を返します。
引数 length が指定された場合はバイナリ読み込みメソッド、そうでない場合......e
IO.open のモードを指定します。
"r" で始まる文字列である必要があります。
: :open_args
IO.open に渡される引数を配列で指定します。
これらの他、 :external_encoding など
IO.open のオプション引数が指定できます。
@see IO.......binread
例:
IO.read(empty_file) #=> ""
IO.read(empty_file, 1) #=> nil
IO.read(one_byte_file, 0, 10) #=> ""
IO.read(one_byte_file, nil, 10) #=> ""
IO.read(one_byte_file, 1, 10) #=> nil...