24件ヒット
[1-24件を表示]
(0.145秒)
クラス
- CSV (12)
- OptionParser (12)
検索結果
-
OptionParser
# to _ a -> [String] (21321.0) -
サマリの各行を要素とした配列を返します。
...の各行を要素とした配列を返します。
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
opts.to_a # => ["Usage: test [options]", " -i, --init\n", " -u, --updat... -
CSV
# col _ sep -> String (226.0) -
カラム区切り文字列として使用する文字列を返します。
...。
//emlist[例][ruby]{
require "csv"
users =<<-EOS
id|first name|last name|age
1|taro|tanaka|20
2|jiro|suzuki|18
3|ami|sato|19
4|yumi|adachi|21
EOS
csv = CSV.new(users, headers: true, col_sep: "|")
csv.col_sep # => "|"
csv.first.to_a # => [["id", "1"], ["first name", "taro"], ["last name", "tan......aka"], ["age", "20"]]
csv = CSV.new(users, headers: true)
csv.col_sep # => ","
csv.first.to_a # => [["id|first name|last name|age", "1|taro|tanaka|20"]]
//}
@see CSV.new...