るりまサーチ (Ruby 2.4.0)

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

別のキーワード

  1. matrix l
  2. kernel $-l
  3. _builtin $-l
  4. lupdecomposition l
  5. l

クラス

キーワード

検索結果

CSV::Table#mode -> Symbol (63649.0)

現在のアクセスモードを返します。

...現在のアクセスモードを返します。

//emlist[例][ruby]{
require "csv"

row = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
table = CSV::Table.new([row])
table.mode # => :col_or_row
table.by_col!
table.mode # => :col
//}...

CSV#binmode -> self (18610.0)

IO#binmode に委譲します。

IO#binmode に委譲します。


@see IO#binmode

CSV#binmode? -> bool (18610.0)

IO#binmode? に委譲します。

IO#binmode? に委譲します。


@see IO#binmode?

CSV::Table#by_col_or_row -> CSV::Table (18364.0)

ミックスモードになっている新しい CSV::Table オブジェクトを返します。

...ミックスモードになっている新しい CSV::Table オブジェクトを返します。

元のテーブルモードを変更せずにメソッドチェーンできるので便利です。しか
し、大きなデータセットに対しても同じだけメモリを消費するので気...
...ださい。

//emlist[例][ruby]{
require "csv"

row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2]).by_col!
table # => #<CSV::Table mode:col row_count:3>
col_or_row_tabl...
...e = table.by_col_or_row
col_or_row_table # => #<CSV::Table mode:col_or_row row_count:3>
table # => #<CSV::Table mode:col row_count:3>
//}...

CSV::Table#by_col_or_row! -> self (18346.0)

自身をミックスモードに変更します。

...ire "csv"

row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2]).by_col!
table # => #<CSV::Table mode:col row_count:3>
table.by_col_or_row!
table # => #<CSV::Tab...

絞り込み条件を変える

CSV::Table#[](header) -> [String] | [nil] (9364.0)

ミックスモードでは、このメソッドは引数に行番号を指定すれば行単位で動作 し、ヘッダの名前を指定すれば列単位で動作します。

...ヘッダの名前を指定すれば列単位で動作します。

このメソッドを呼び出す前に CSV::Table#by_col! を呼び出すとカラム
モードになります。また CSV::Table#by_row! を呼び出すとロウモード
になります。

@param index ミックスモード・...
...][ruby]{
require "csv"

row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])

# ミックスモード
p table.mode # => :col_or_row
p table[0] # => #<CSV::Row "header1":"...
...row1_1" "header2":"row1_2">
p table[1] # => #<CSV::Row "header1":"row2_1" "header2":"row2_2">
p table["header2"] # => ["row1_2", "row2_2"]
p table[0..1] # => [#<CSV::Row "header1":"row1_1" "header2":"row1_2">, #<CSV::Row "header1":"row2_1" "header2":"row2_2">]

# カラムモード
tabl...

CSV::Table#[](index) -> CSV::Row | [String] | nil (9364.0)

ミックスモードでは、このメソッドは引数に行番号を指定すれば行単位で動作 し、ヘッダの名前を指定すれば列単位で動作します。

...ヘッダの名前を指定すれば列単位で動作します。

このメソッドを呼び出す前に CSV::Table#by_col! を呼び出すとカラム
モードになります。また CSV::Table#by_row! を呼び出すとロウモード
になります。

@param index ミックスモード・...
...][ruby]{
require "csv"

row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])

# ミックスモード
p table.mode # => :col_or_row
p table[0] # => #<CSV::Row "header1":"...
...row1_1" "header2":"row1_2">
p table[1] # => #<CSV::Row "header1":"row2_1" "header2":"row2_2">
p table["header2"] # => ["row1_2", "row2_2"]
p table[0..1] # => [#<CSV::Row "header1":"row1_1" "header2":"row1_2">, #<CSV::Row "header1":"row2_1" "header2":"row2_2">]

# カラムモード
tabl...

CSV::Table#[](range) -> [CSV::Row]| [Array] | nil (9364.0)

ミックスモードでは、このメソッドは引数に行番号を指定すれば行単位で動作 し、ヘッダの名前を指定すれば列単位で動作します。

...ヘッダの名前を指定すれば列単位で動作します。

このメソッドを呼び出す前に CSV::Table#by_col! を呼び出すとカラム
モードになります。また CSV::Table#by_row! を呼び出すとロウモード
になります。

@param index ミックスモード・...
...][ruby]{
require "csv"

row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])

# ミックスモード
p table.mode # => :col_or_row
p table[0] # => #<CSV::Row "header1":"...
...row1_1" "header2":"row1_2">
p table[1] # => #<CSV::Row "header1":"row2_1" "header2":"row2_2">
p table["header2"] # => ["row1_2", "row2_2"]
p table[0..1] # => [#<CSV::Row "header1":"row1_1" "header2":"row1_2">, #<CSV::Row "header1":"row2_1" "header2":"row2_2">]

# カラムモード
tabl...

CSV::Table#by_row -> CSV::Table (9346.0)

ロウモードになっている新しい CSV::Table オブジェクトを返します。

...ロウモードになっている新しい CSV::Table オブジェクトを返します。

元のテーブルモードを変更せずにメソッドチェーンできるので便利です。しか
し、大きなデータセットに対しても同じだけメモリを消費するので気をつ...
...by]{
require "csv"

row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])
table # => #<CSV::Table mode:col_or_row row_count:3>
row_table = table.by_row # => #<CSV::Table mode:r...
...ow row_count:3>
row_table[0] # => #<CSV::Row "header1":"row1_1" "header2":"row1_2">
row_table[1] # => #<CSV::Row "header1":"row2_1" "header2":"row2_2">
//}...

CSV::Table#by_row! -> self (9346.0)

自身をロウモードに変更します。

...y]{
require "csv"

row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])
table # => #<CSV::Table mode:col_or_row row_count:3>
table.by_row!
table # => #<CSV::Table mode:...
...row row_count:3>
table[0] # => #<CSV::Row "header1":"row1_1" "header2":"row1_2">
table[1] # => #<CSV::Row "header1":"row2_1" "header2":"row2_2">
//}...

絞り込み条件を変える

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

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

...い値が指定されていた場合は CSV::Table オブジェクトを返します。

データソースは読み込み用にオープンされている必要があります。

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

csv
= CSV.new(DATA.read)
csv
.read
# => [["header1", "header2"], ["ro...
..._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
# => #<CSV::Table mode:col_or_row row_count:3>

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

CSV::Table#inspect -> String (9028.0)

モードとサイズを US-ASCII な文字列で返します。

...モードとサイズを US-ASCII な文字列で返します。

//emlist[][ruby]{
require 'csv'
csv
= CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.inspect # => "#<CSV::Table mode:col_or_row row_count:2>"
//}...

CSV#read -> [Array] | CSV::Table (328.0)

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

...い値が指定されていた場合は CSV::Table オブジェクトを返します。

データソースは読み込み用にオープンされている必要があります。

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

csv
= CSV.new(DATA.read)
csv
.read
# => [["header1", "header2"], ["ro...
..._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
# => #<CSV::Table mode:col_or_row row_count:3>

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