るりまサーチ

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

別のキーワード

  1. array fill
  2. array sample
  3. array []
  4. array count
  5. array new

ライブラリ

クラス

キーワード

検索結果

CSV#converters -> Array (18232.0)

現在の変換器のリストを返します。

...在の変換器のリストを返します。

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

csv = CSV.new("header1,header2\nrow1_1,row1_2", converters: CSV::Converters.keys)
csv.converters # => [:integer, :float, :integer, :float, :date, :date_time, :date_time, :integer, :float]
//}

@see CSV::Converters...

CSV#header_converters -> Array (6226.0)

現在有効なヘッダ用変換器のリストを返します。

...ェクトを返します。

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

csv = CSV.new("HEADER1,HEADER2\nrow1_1,row1_2", headers: true, header_converters: CSV::HeaderConverters.keys)
csv.header_converters # => [:downcase, :symbol]
csv.read.to_a # => header2], ["row1_1", "row1_2"
//}

@see CSV.new...

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

以下と同等のことを行うメソッドです。

...list[][ruby]{
CSV.read( path, { headers: true,
converters
: :numeric,
header_converters: :symbol }.merge(options) )
//}

@param path ファイル名を指定します。

@param options CSV.new のオプションと同じオプションを指定で...

CSV (30.0)

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

...<< ["another", "row"]
# ...
end
//}

=== 一行変換

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

csv_string = ["CSV", "data"].to_csv # => "CSV,data"
csv_array = "CSV,String".parse_csv # => ["CSV", "String"]
//}

=== ショートカット

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

CSV { |csv_out| cs...
...on)

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 transcoded
(unless you ask Ruby to transcode it for you) and will literally be parsed in
the Encoding it is in. Thus CSV will return Arrays or Rows...
...CSV's core parser is now
Encoding agnostic, some features are not. For example, the built-in
converters
will try to transcode data to UTF-8 before making conversions.
Again, you can provide custom converters that are aware of your Encodings to
avoid this translation. It's just too hard for me to s...