るりまサーチ

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.212秒)

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. kernel require
  5. bigdecimal to_r

ライブラリ

クラス

検索結果

OptionParser#to_a -> [String] (27421.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, --update\n", " -h, --help\n"]
//}...

CSV#col_sep -> String (326.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", "tanaka"]...
..., ["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...