るりまサーチ

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

別のキーワード

  1. uri default_port
  2. _builtin default
  3. generic default_port
  4. socket ip_default_multicast_ttl
  5. socket ip_default_multicast_loop

種類

ライブラリ

クラス

キーワード

検索結果

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

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

... Encoding.default_external と異なる場合は
必ず指定しなければなりません。

//emlist[例][ruby]{
require "csv"
require "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(...
..."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"...

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

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

... Encoding.default_external と異なる場合は
必ず指定しなければなりません。

//emlist[例][ruby]{
require "csv"
require "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(...
..."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 (78.0)

基本的な入出力機能のためのクラスです。

...さい。
以下がテキスト読み込みメソッドです。

* IO.foreach
* IO.readlines
* IO#each_line
* IO#lines
* IO#gets
* IO#getc
* IO#ungetc
* IO#read
* IO#readchar
* IO#readline
* IO#readlines

バイナリ読み込みメソッドは IO のエンコーディングの影響を...
...ーディングは常に ASCII-8BIT になります。
以下がバイナリ読み込みメソッドです。

* IO#read(size)
* IO#read_nonblock
* IO#readpartial
* IO#sysread

また書き込みメソッド IO#write も IO のエンコーディングの影響を受けます。
IO のすべて...
...ていない場合

IO からテキスト読み込みメソッドによって読み込まれた文字列のエンコーディングは Encoding.default_external
に設定されます。このとき実際の文字エンコーディングは検査されず、変換もされません。

: 外部...
...て下さい。
以下がテキスト読み込みメソッドです。

* IO.foreach
* IO.readlines
* IO#each_line
* IO#gets
* IO#getc
* IO#ungetc
* IO#read
* IO#readchar
* IO#readline
* IO#readlines

バイナリ読み込みメソッドは IO のエンコーディングの影響を受け...

NEWS for Ruby 2.3.0 (36.0)

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

...て <<~ で始まるヒアドキュメントが追加されました
9098

=== 組み込みクラスの更新

* ARGF
* ARGF.read_nonblock は IO#read_nonblock と同じように `exception: false' オプションをサポートします
11358

* Array
* Array#bsearch_index...
...show each method (show block lines directly).
TracePoint also ignores these calls.
11569

* Queue (Thread::Queue)
* 終了を通知するために Queue#close(Thread::Queue#close) を追加
10600

* Regexp/String: Unicode のバージョンを 7.0.0 から 8.0.0 に更新...
...た要素には
`#to_ary`を呼ばないようになりました。
10748
* Array#inspect はその要素の文字列が Encoding.default_external
互換性のないエンコーディングであっても例外が発生しなくなりました。
11801

* Enumerable...

NEWS for Ruby 3.0.0 (24.0)

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

...hash excluding the given keys and their values. 15822
* Windows: Read ENV names and values as UTF-8 encoded Strings 12650
* Encoding
* Added new encoding IBM720. 16233
* Changed default for Encoding.default_external to UTF-8 on Windows 16604
* Fiber
* Fiber.new(blocking: true/f...
...turns a hash excluding the given keys and their values. 15822
* IO
* IO#nonblock? now defaults to `true`. 16786
* IO#wait_readable, IO#wait_writable, IO#read, IO#write and other related methods (e.g. IO#puts, IO#gets) may invoke the scheduler hook `#io_wait(io, events, timeout)` in a non-...
...leep(...)` in a non-blocking execution context. 16786
* Module
* Module#include and Module#prepend now affect classes and modules that have already included or prepended the receiver, mirroring the behavior if the arguments were included in the receiver before the other modules and classes inc...

絞り込み条件を変える

CSV.open(filename, mode = "rb", options = Hash.new) -> CSV (18.0)

このメソッドは IO オブジェクトをオープンして CSV でラップします。 これは CSV ファイルを書くための主要なインターフェイスとして使うことを意図しています。

...それをクローズします。
ブロックが与えられなかった場合は CSV オブジェクトを返します。

データが Encoding.default_external と異なる場合は、mode にエンコー
ディングを指定する文字列を埋め込まなければなりません。データ...
...

CSV オブジェクトは多くのメソッドを IO や File に委譲します。

* IO#binmode
* IO#binmode?
* IO#close
* IO#close_read
* IO#close_write
* IO#closed?
* IO#eof
* IO#eof?
* IO#external_encoding
* IO#fcntl
* IO#fileno
* File#flock
* IO#flush
* IO#fsyn...
...", "tanaka", "20"]
csv << ["2", "jiro", "suzuki", "18"]
csv << ["3", "ami", "sato", "19"]
csv << ["4", "yumi", "adachi", "21"]
end
print File.read("test.csv")

# => id,first name,last name,age
# 1,taro,tanaka,20
# 2,jiro,suzuki,18
# 3,ami,sato,19
# 4,yumi,adachi,21
//}

@see CSV.ne...

CSV.open(filename, mode = "rb", options = Hash.new) {|csv| ... } -> nil (18.0)

このメソッドは IO オブジェクトをオープンして CSV でラップします。 これは CSV ファイルを書くための主要なインターフェイスとして使うことを意図しています。

...それをクローズします。
ブロックが与えられなかった場合は CSV オブジェクトを返します。

データが Encoding.default_external と異なる場合は、mode にエンコー
ディングを指定する文字列を埋め込まなければなりません。データ...
...

CSV オブジェクトは多くのメソッドを IO や File に委譲します。

* IO#binmode
* IO#binmode?
* IO#close
* IO#close_read
* IO#close_write
* IO#closed?
* IO#eof
* IO#eof?
* IO#external_encoding
* IO#fcntl
* IO#fileno
* File#flock
* IO#flush
* IO#fsyn...
...", "tanaka", "20"]
csv << ["2", "jiro", "suzuki", "18"]
csv << ["3", "ami", "sato", "19"]
csv << ["4", "yumi", "adachi", "21"]
end
print File.read("test.csv")

# => id,first name,last name,age
# 1,taro,tanaka,20
# 2,jiro,suzuki,18
# 3,ami,sato,19
# 4,yumi,adachi,21
//}

@see CSV.ne...

CSV.open(filename, options = Hash.new) -> CSV (18.0)

このメソッドは IO オブジェクトをオープンして CSV でラップします。 これは CSV ファイルを書くための主要なインターフェイスとして使うことを意図しています。

...それをクローズします。
ブロックが与えられなかった場合は CSV オブジェクトを返します。

データが Encoding.default_external と異なる場合は、mode にエンコー
ディングを指定する文字列を埋め込まなければなりません。データ...
...

CSV オブジェクトは多くのメソッドを IO や File に委譲します。

* IO#binmode
* IO#binmode?
* IO#close
* IO#close_read
* IO#close_write
* IO#closed?
* IO#eof
* IO#eof?
* IO#external_encoding
* IO#fcntl
* IO#fileno
* File#flock
* IO#flush
* IO#fsyn...
...", "tanaka", "20"]
csv << ["2", "jiro", "suzuki", "18"]
csv << ["3", "ami", "sato", "19"]
csv << ["4", "yumi", "adachi", "21"]
end
print File.read("test.csv")

# => id,first name,last name,age
# 1,taro,tanaka,20
# 2,jiro,suzuki,18
# 3,ami,sato,19
# 4,yumi,adachi,21
//}

@see CSV.ne...

CSV.open(filename, options = Hash.new) {|csv| ... } -> nil (18.0)

このメソッドは IO オブジェクトをオープンして CSV でラップします。 これは CSV ファイルを書くための主要なインターフェイスとして使うことを意図しています。

...それをクローズします。
ブロックが与えられなかった場合は CSV オブジェクトを返します。

データが Encoding.default_external と異なる場合は、mode にエンコー
ディングを指定する文字列を埋め込まなければなりません。データ...
...

CSV オブジェクトは多くのメソッドを IO や File に委譲します。

* IO#binmode
* IO#binmode?
* IO#close
* IO#close_read
* IO#close_write
* IO#closed?
* IO#eof
* IO#eof?
* IO#external_encoding
* IO#fcntl
* IO#fileno
* File#flock
* IO#flush
* IO#fsyn...
...", "tanaka", "20"]
csv << ["2", "jiro", "suzuki", "18"]
csv << ["3", "ami", "sato", "19"]
csv << ["4", "yumi", "adachi", "21"]
end
print File.read("test.csv")

# => id,first name,last name,age
# 1,taro,tanaka,20
# 2,jiro,suzuki,18
# 3,ami,sato,19
# 4,yumi,adachi,21
//}

@see CSV.ne...