7件ヒット
[1-7件を表示]
(0.024秒)
検索結果
先頭5件
-
CSV
:: Table # empty? -> bool (22.0) -
ヘッダーを除いて、データがないときに true を返します。
ヘッダーを除いて、データがないときに true を返します。
Array#empty? に委譲しています。
//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b\n", headers: true)
table = csv.read
p table.empty? # => true
table << [1, 2]
p table.empty? # => false
//}
@see Array#empty? -
CSV
:: Table # inspect -> String (22.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
:: Table # length -> Integer (22.0) -
(ヘッダを除く)行数を返します。
(ヘッダを除く)行数を返します。
Array#length, Array#size に委譲しています。
//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.size # => 1
//}
@see Array#length, Array#size -
CSV
:: Table # push(*rows) -> self (22.0) -
複数の行を追加するためのショートカットです。
...ire 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
rows = [
CSV::Row.new(table.headers, [4, 5, 6]),
[7, 8, 9]
]
table.push(*rows)
p table[0..2]
# => [#<CSV::Row "a":"1" "b":"2" "c":"3">, #<CSV::Row "a":4 "b":5 "c":6>, #<CSV::Row "a":7 "b":8 "c":9>]
//}
@see CSV::Table#<<... -
CSV
:: Table # size -> Integer (22.0) -
(ヘッダを除く)行数を返します。
(ヘッダを除く)行数を返します。
Array#length, Array#size に委譲しています。
//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.size # => 1
//}
@see Array#length, Array#size -
CSV
:: Table # to _ csv(options = Hash . new) -> String (22.0) -
CSV の文字列に変換して返します。
CSV の文字列に変換して返します。
ヘッダを一行目に出力します。その後に残りのデータを出力します。
デフォルトでは、ヘッダを出力します。オプションに :write_headers =>
false を指定するとヘッダを出力しません。
//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.to_csv # => "a,b,c\n1,2,3\n"
p table.to_csv(write_head... -
CSV
:: Table # to _ s(options = Hash . new) -> String (22.0) -
CSV の文字列に変換して返します。
CSV の文字列に変換して返します。
ヘッダを一行目に出力します。その後に残りのデータを出力します。
デフォルトでは、ヘッダを出力します。オプションに :write_headers =>
false を指定するとヘッダを出力しません。
//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.to_csv # => "a,b,c\n1,2,3\n"
p table.to_csv(write_head...