るりまサーチ

最速Rubyリファレンスマニュアル検索!
102件ヒット [1-100件を表示] (0.051秒)
トップページ > クエリ:new[x] > クエリ:line[x] > クエリ:readlines[x]

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

NEWS for Ruby 2.6.0 (26132.0)

NEWS for Ruby 2.6.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...NEWS for Ruby 2.6.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...ing#source_location 追加 14230
* bindingのソースコード上の位置を __FILE__ と __LINE__ の二要素配列として返します。
従来でも eval("[__FILE__, __LINE__]", binding) とすることでこれらの情報は得られましたが、
将来的に...
...予定で、
今は警告が出ます。 14643

* File
* File.read, File.binread, File.write, File.binwrite,
File.foreach, File.readlines はパスがパイプ文字 '|' で始まっていても
外部コマンドを実行しなくなりました。 14245

* Object
* Ob...

NEWS for Ruby 2.4.0 (26054.0)

NEWS for Ruby 2.4.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...NEWS for Ruby 2.4.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...うになりました。
half には :even, :up, :down が指定可能です。 12548 12958 12953

* IO
* IO#gets, IO#readline, IO#each_line, IO#readlines, IO.foreach は
chomp というキーワード引数を受け付けるようになりました。12553

* Kernel
* Kernel...
...asecmp? を追加 12786
* String#concat, String#prepend 複数の引数を受け付けるようになりました 12333
* String#each_line, String#lines 省略可能なキーワード引数 chomp を受け付けるようになりました 12553
* String#match? を追加 12898
* Strin...

StringIO#readlines(rs = $/) -> [String] (24219.0)

自身からデータを全て読み込んで、その各行を要素としてもつ配列を返します。 既に文字列の終端に達していれば空配列 [] を返します。

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

//emlist[例][ruby]{
require "stringio"
a = StringIO.new("hoge\nfoo\nbar\n")
a.readlines #=> ["hoge\n", "foo\n", "bar\n"]
a.readlines #=> []
//}

@see $/...

CSV.readlines(path, options = Hash.new) -> [Array] | CSV::Table (18315.0)

CSV ファイルを配列の配列にするために使います。 headers オプションに偽でない値を指定した場合は CSV::Table オブジェクトを返します。

...定した場合は CSV::Table オブジェクトを返します。

@param path CSV ファイルのパスを指定します。

@param options CSV.new のオプションと同じオプションを指定できます。
:encoding というキーを使用すると入力のエンコーデ...
...<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">
//}

@see CSV.new, CSV.table...

CSV#readlines -> [Array] | CSV::Table (18213.0)

残りの行を読み込んで配列の配列を返します。 self の生成時に headers オプションに偽でない値が指定されていた場合は CSV::Table オブジェクトを返します。

...: false][ruby]{
require "csv"

csv = CSV.new(DATA.read)
csv.read
# => [["header1", "header2"], ["row1_1", "row1_2"], ["row2_1", "row2_2"]]

__END__
header1,header2
row1_1,row1_2
row2_1,row2_2
//}

//emlist[例 headers: true][ruby]{
require "csv"

csv = CSV.new(DATA.read, headers: true)
csv.read
# =>...

絞り込み条件を変える

IO#reopen(path) -> self (72.0)

path で指定されたファイルにストリームを繋ぎ換えます。

...O#lineno などはリセットされます。

@param path パスを表す文字列を指定します。

@param mode パスを開く際のモードを文字列で指定します。

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

//emlist[例][ruby]{
IO.write("testfile", "This is line o...
...his is line two\n")
f1 = File.new("testfile", "a+")
f2 = File.new("testfile")
f1.print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<File:testfile>
f2.readlines # => ["This is line one\...
...n", "This is line two\n", "This is line three\n"]
f2.close
//}

@see Kernel.#open...

IO#reopen(path, mode) -> self (72.0)

path で指定されたファイルにストリームを繋ぎ換えます。

...O#lineno などはリセットされます。

@param path パスを表す文字列を指定します。

@param mode パスを開く際のモードを文字列で指定します。

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

//emlist[例][ruby]{
IO.write("testfile", "This is line o...
...his is line two\n")
f1 = File.new("testfile", "a+")
f2 = File.new("testfile")
f1.print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<File:testfile>
f2.readlines # => ["This is line one\...
...n", "This is line two\n", "This is line three\n"]
f2.close
//}

@see Kernel.#open...

CSV (18.0)

このクラスは CSV ファイルやデータに対する完全なインターフェイスを提供します。

...tderr) { |csv_err| csv_err << %w{my data here} } # to $stderr
//}

=== CSV と文字エンコーディング (M17n or Multilingualization)

This new CSV parser is m17n savvy. The parser works in the Encoding of the IO
or String object being read from or written to. Your data is never transcode...
...r Encoding set and everything should just work.
CSV methods that allow you to open IO objects (CSV::foreach(), CSV::open(),
CSV::read(), and CSV::readlines()) do allow you to specify the Encoding.

One minor exception comes when generating CSV into a String with an Encoding
that is not ASCII compati...
...ble. There's no existing data for CSV to use to
prepare itself and thus you will probably need to manually specify the desired
Encoding for most of those cases. It will try to guess using the fields in a
row of output though, when using CSV::generate_line() or Array#to_csv()....

Kernel$$stdin -> object (18.0)

標準入力です。

...しく実装していなければいけません。

gets, readline, readlines, getc, readchar, tell, seek,
pos=, rewind, fileno, to_io, eof, each_line, each_byte,
binmode, closed?

//emlist[例][ruby]{
$stdin = Object.new
def $stdin.gets
"foo"
end
p gets() # => "foo"
//}

自プロ...

IO#reopen(io) -> self (12.0)

自身を指定された io に繋ぎ換えます。

...自身を指定された io に繋ぎ換えます。

クラスも io に等しくなることに注意してください。
IO#pos, IO#lineno などは指定された io と等しくなります。

@param io 自身を繋ぎ換えたい IO オブジェクトを指定します。

@raise IOError...

絞り込み条件を変える

<< 1 2 > >>