るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

CSV#converters -> Array (18226.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 (6214.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] (113.0)

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

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

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

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

@param options CSV.new の...

CSV (24.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...
...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 of Strings in the
Encoding of your data. This is accomplished by transcoding the parser itself
into your Encoding.

Some transcoding mus...
...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...