別のキーワード
ライブラリ
- ビルトイン (509)
- csv (110)
- json (11)
- open-uri (22)
- openssl (11)
- readline (66)
-
rubygems
/ package / tar _ header (11) -
rubygems
/ package / tar _ reader (11) -
rubygems
/ specification (11) - tempfile (30)
- thread (2)
-
win32
/ registry (44) - zlib (33)
クラス
- CSV (110)
- File (88)
-
Gem
:: Package :: TarHeader (11) -
Gem
:: Package :: TarReader (11) -
Gem
:: Specification (11) - IO (374)
-
JSON
:: Parser (11) -
OpenSSL
:: PKCS7 (11) - Tempfile (30)
- Thread (38)
-
Thread
:: ConditionVariable (11) -
Win32
:: Registry (44) -
Zlib
:: GzipReader (33)
キーワード
-
abort
_ on _ exception (11) -
abort
_ on _ exception= (11) - binread (11)
-
completion
_ append _ character (11) -
completion
_ append _ character= (11) -
completion
_ case _ fold (11) -
completion
_ case _ fold= (11) -
completion
_ proc (11) -
completion
_ proc= (11) -
copy
_ stream (22) - from (11)
- instance (22)
- link (11)
- new (98)
- open (108)
-
open
_ uri (22) - pipe (88)
- popen (154)
-
read
_ only (11) -
read
_ smime (11) - readable? (11)
-
readable
_ real? (11) - readlines (44)
- readlink (11)
-
report
_ on _ exception (8) -
report
_ on _ exception= (8) - select (11)
- table (11)
-
world
_ readable? (11) - wrap (22)
- write (22)
検索結果
先頭5件
-
IO
. read(path , **opt) -> String | nil (27200.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 (27200.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 (27200.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... -
CSV
. read(path , options = Hash . new) -> [Array] | CSV :: Table (18214.0) -
CSV ファイルを配列の配列にするために使います。 headers オプションに偽でない値を指定した場合は CSV::Table オブジェクトを返します。
...値を指定した場合は CSV::Table オブジェクトを返します。
@param path CSV ファイルのパスを指定します。
@param options CSV.new のオプションと同じオプションを指定できます。
:encoding というキーを使用すると入力のエン......equire "pp"
File.write("test.csv", <<CSV)
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
pp CSV.read("test.csv")
# => [["id", "first name", "last name", "age"],
# ["1", "taro", "tanaka", "20"],
# ["2", "jiro", "suzuki", "18"],
# ["3", "am......"csv"
File.write("test.csv", <<CSV)
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
table = CSV.read("test.csv", headers: true)
p table.class # => CSV::Table
p table[0] # => #<CSV::Row "id":"1" "first name":"taro" "last name":"tanaka" "age":"20"... -
IO
. binread(path , length = nil , offset = 0) -> String | nil (15137.0) -
path で指定したファイルを open し、offset の所まで seek し、 length バイト読み込みます。
...例][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...\n")
IO.binread("testfile") # => "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
IO.binread("testfile", 20) # => "This is line one\nThi"
IO.binread("testfile......", 20, 10) # => "ne one\nThis is line "
//}
@see IO.read... -
IO
. readlines(path , limit , chomp: false , opts={}) -> [String] (15137.0) -
path で指定されたファイルを全て読み込んで、その各行を要素としてもつ配列を返します。
...emlist[例][ruby]{
IO.write("testfile", "line1\nline2,\nline3\n")
IO.readlines("testfile") # => ["line1\n", "line2,\n", "line3\n"]
IO.readlines("testfile", ",") # => ["line1\nline2,", "\nline3\n"]
//}
//emlist[例: rs を取り除く(chomp = true)][ruby]{
IO.write("testfile",......"line1,\rline2,\r\nline3,\n")
IO.readlines("testfile", chomp: true) # => ["line1,\rline2,", "line3,"]
IO.readlines("testfile", "\r", chomp: true) # => ["line1,", "line2,", "\nline3,\n"]
//}... -
IO
. readlines(path , rs = $ / , chomp: false , opts={}) -> [String] (15137.0) -
path で指定されたファイルを全て読み込んで、その各行を要素としてもつ配列を返します。
...emlist[例][ruby]{
IO.write("testfile", "line1\nline2,\nline3\n")
IO.readlines("testfile") # => ["line1\n", "line2,\n", "line3\n"]
IO.readlines("testfile", ",") # => ["line1\nline2,", "\nline3\n"]
//}
//emlist[例: rs を取り除く(chomp = true)][ruby]{
IO.write("testfile",......"line1,\rline2,\r\nline3,\n")
IO.readlines("testfile", chomp: true) # => ["line1,\rline2,", "line3,"]
IO.readlines("testfile", "\r", chomp: true) # => ["line1,", "line2,", "\nline3,\n"]
//}... -
IO
. readlines(path , rs , limit , chomp: false , opts={}) -> [String] (15137.0) -
path で指定されたファイルを全て読み込んで、その各行を要素としてもつ配列を返します。
...emlist[例][ruby]{
IO.write("testfile", "line1\nline2,\nline3\n")
IO.readlines("testfile") # => ["line1\n", "line2,\n", "line3\n"]
IO.readlines("testfile", ",") # => ["line1\nline2,", "\nline3\n"]
//}
//emlist[例: rs を取り除く(chomp = true)][ruby]{
IO.write("testfile",......"line1,\rline2,\r\nline3,\n")
IO.readlines("testfile", chomp: true) # => ["line1,\rline2,", "line3,"]
IO.readlines("testfile", "\r", chomp: true) # => ["line1,", "line2,", "\nline3,\n"]
//}... -
IO
. readlines(path , limit , opts={}) -> [String] (15119.0) -
path で指定されたファイルを全て読み込んで、その各行を要素としてもつ配列を返します。
...、ファイルの読み込みに失敗した場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "line1\nline2,\nline3\n")
IO.readlines("testfile") # => ["line1\n", "line2,\n", "line3\n"]
IO.readlines("testfile", ",") # => ["line1\nline2,", "\nline3\n"]
//}... -
IO
. readlines(path , rs = $ / , opts={}) -> [String] (15119.0) -
path で指定されたファイルを全て読み込んで、その各行を要素としてもつ配列を返します。
...、ファイルの読み込みに失敗した場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "line1\nline2,\nline3\n")
IO.readlines("testfile") # => ["line1\n", "line2,\n", "line3\n"]
IO.readlines("testfile", ",") # => ["line1\nline2,", "\nline3\n"]
//}... -
IO
. readlines(path , rs , limit , opts={}) -> [String] (15119.0) -
path で指定されたファイルを全て読み込んで、その各行を要素としてもつ配列を返します。
...、ファイルの読み込みに失敗した場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "line1\nline2,\nline3\n")
IO.readlines("testfile") # => ["line1\n", "line2,\n", "line3\n"]
IO.readlines("testfile", ",") # => ["line1\nline2,", "\nline3\n"]
//}... -
IO
. pipe {|read _ io , write _ io| . . . } -> object (9381.0) -
pipe(2) を実行して、相互につながった2つの IO オブジェクトを要素とする配列を返します。
...相互につながった2つの
IO オブジェクトを要素とする配列を返します。
戻り値の配列は最初の要素が読み込み側で、次の要素が書き込み側です。
ブロックが渡された場合は、そのブロックに2つの IO オブジェクトが渡され......ソッドの返り値となります。
ブロック終了時に IO オブジェクトがもし close されていないならば
close します(close されていてるオブジェクトはそのままです)。
得られる2つの IO オブジェクトのエンコーディングを引数で指......ングなどを設定するキーワード引数(see IO.new)
@raise Errno::EXXX IO オブジェクトの作成に失敗した場合に発生します。
r, w = IO.pipe
p [r, w] # => [#<IO:0x401b90f8>, #<IO:0x401b7718>]
Thread.new do
w.puts "foo"
w.close
end
p r.gets... -
IO
. pipe(enc _ str , **opts) {|read _ io , write _ io| . . . } -> object (9381.0) -
pipe(2) を実行して、相互につながった2つの IO オブジェクトを要素とする配列を返します。
...相互につながった2つの
IO オブジェクトを要素とする配列を返します。
戻り値の配列は最初の要素が読み込み側で、次の要素が書き込み側です。
ブロックが渡された場合は、そのブロックに2つの IO オブジェクトが渡され......ソッドの返り値となります。
ブロック終了時に IO オブジェクトがもし close されていないならば
close します(close されていてるオブジェクトはそのままです)。
得られる2つの IO オブジェクトのエンコーディングを引数で指......ングなどを設定するキーワード引数(see IO.new)
@raise Errno::EXXX IO オブジェクトの作成に失敗した場合に発生します。
r, w = IO.pipe
p [r, w] # => [#<IO:0x401b90f8>, #<IO:0x401b7718>]
Thread.new do
w.puts "foo"
w.close
end
p r.gets...