るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

NEWS for Ruby 2.6.0 (26108.0)

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

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

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...proc やメソッドに対応する AST ノードを返します。 [実験的]

* RubyVM
* 新規メソッド
* RubyVM.resolve_feature_path は "require(feature)" で読み込むファイルを
特定します。 [実験的] 15230

* String
* String#crypt は非推奨に...
...予定で、
今は警告が出ます。 14643

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

* Object
* Ob...

CSV.readlines(path, options = Hash.new) -> [Array] | CSV::Table (15323.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.read(path, options = Hash.new) -> [Array] | CSV::Table (223.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...

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

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

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

第二引数を省略したとき self のモードをそのまま引き継ぎます。
IO#pos, IO#lineno などはリセットされます。

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

@param mode パ...
...ne\nThis 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...

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

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

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

第二引数を省略したとき self のモードをそのまま引き継ぎます。
IO#pos, IO#lineno などはリセットされます。

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

@param mode パ...
...ne\nThis 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...

絞り込み条件を変える

CSV (18.0)

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

...csv_text)
# => [["Ruby", "1995"], ["Rust", "2010"]]
//}

=== 書き込み

//emlist[][ruby]{
require 'csv'

# ファイルへ書き込み
CSV.open("path/to/file.csv", "wb") do |csv|
csv << ["row", "of", "CSV", "data"]
csv << ["another", "row"]
# ...
end

# 文字列へ書き込み
csv_string =...
...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...

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

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

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

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

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

@raise IOError 指定された io が close されている場合に発生します。