11件ヒット
[1-11件を表示]
(0.025秒)
クラス
- CSV (7)
-
CSV
:: Row (3) -
CSV
:: Table (1)
検索結果
先頭5件
-
CSV
# stat -> File :: Stat (18610.0) -
IO#stat に委譲します。
IO#stat に委譲します。
@see IO#stat -
CSV
# truncate(path , length) -> 0 (18610.0) -
File#truncate に委譲します。
File#truncate に委譲します。
@see File#truncate -
CSV
:: Table # values _ at(indices _ or _ headers) -> Array (18349.0) -
デフォルトのミックスモードでは、インデックスのリストを与えると行単位の 参照を行い、行の配列を返します。他の方法は列単位の参照と見なします。行 単位の参照では、返り値は行ごとの配列を要素に持つ配列です。
...たい場合は CSV::Table#by_col!,
CSV::Table#by_row! を使用してください。
アクセスモードを混在させることはできません。
//emlist[例 ロウモード][ruby]{
require "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["heade......["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])
table.values_at(1) # => [#<CSV::Row "header1":"row2_1" "header2":"row2_2">]
//}
//emlist[例 カラムモード][ruby]{
require "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header......2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])
table.by_col!
table.values_at(1) # => [["row1_2"], ["row2_2"]]
//}
@see CSV::Table#by_col!, CSV::Table#by_row!... -
CSV
# isatty -> bool (18310.0) -
IO#isatty, IO#tty? に委譲します。
IO#isatty, IO#tty? に委譲します。
@see IO#isatty, IO#tty? -
CSV
# path -> String (18310.0) -
IO#path に委譲します。
IO#path に委譲します。
@see IO#path -
CSV
:: Row # values _ at(*headers _ and _ or _ indices) -> Array (9331.0) -
与えられた引数に対応する値の配列を返します。
...与えられた引数に対応する値の配列を返します。
要素の探索に CSV::Row.field を使用しています。
@param headers_and_or_indices ヘッダの名前かインデックスか Range
のインスタンスか第 1 要素がヘッダの名前......るこ
とができます。
@return 引数を与えなかった場合は全ての要素を返します。
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
row = table.first
row.values_at("a", 1, 2..3) # => ["1", "2", "3", nil]... -
CSV
# tty? -> bool (9010.0) -
IO#isatty, IO#tty? に委譲します。
IO#isatty, IO#tty? に委譲します。
@see IO#isatty, IO#tty? -
CSV
# flock(operation) -> 0 | false (310.0) -
File#flock に委譲します。
File#flock に委譲します。 -
CSV
# sync=(newstate) (310.0) -
IO#sync= に委譲します。
IO#sync= に委譲します。
@see IO#sync= -
CSV
:: Row # field?(data) -> bool (310.0) -
自身に与えられた値が含まれている場合は真を返します。 そうでない場合は偽を返します。
...ない場合は偽を返します。
@param data この行に含まれているかどうか調べたい値を指定します。
//emlist[例][ruby]{
require "csv"
row = CSV::Row.new(["header1", "header2", "header3", "header4"], [1, 2, 3, 4])
row.field?(1) # => true
row.field?(5) # => false
//}... -
CSV
:: Row # fields(*headers _ and _ or _ indices) -> Array (31.0) -
与えられた引数に対応する値の配列を返します。
...与えられた引数に対応する値の配列を返します。
要素の探索に CSV::Row.field を使用しています。
@param headers_and_or_indices ヘッダの名前かインデックスか Range
のインスタンスか第 1 要素がヘッダの名前......るこ
とができます。
@return 引数を与えなかった場合は全ての要素を返します。
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
row = table.first
row.values_at("a", 1, 2..3) # => ["1", "2", "3", nil]...