るりまサーチ

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

別のキーワード

  1. etc sc_xopen_enh_i18n
  2. rsa n=
  3. rsa n
  4. pop n_bytes
  5. pop n_mails

モジュール

キーワード

検索結果

<< < ... 19 20 21 >>

CSV::Table#each {|row| ... } -> self (127.0)

デフォルトのミックスモードかロウモードでは、行単位で繰り返します。カラ ムモードでは、ブロックに列名と対応する値の配列を与え、列単位で繰り返し ます。

...ow.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
row3 = CSV::Row.new(["header1", "header2"], ["row3_1", "row3_2"])
table = CSV::Table.new([row1, row2, row3])
table.each { |row| p row }

# => #<CSV::Row "header1":"row1_1" "header2"...
...2">
# => #<CSV::Row "header1":"row2_1" "header2":"row2_2">
# => #<CSV::Row "header1":"row3_1" "header2":"row3_2">
//}

//emlist[例 カラムモード][ruby]{
require "csv"

row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2...
..._2"])
row3 = CSV::Row.new(["header1", "header2"], ["row3_1", "row3_2"])
table = CSV::Table.new([row1, row2, row3])
table.by_col!
table.each { |column_name, values| print column_name, values, "\n" }

# => header1["row1_1", "row2_1", "row3_1"]
# => header2["row1_2", "row2_2", "row3_2"]
//}...

CSV#row_sep -> String (125.0)

行区切り文字列として使用する文字列を返します。

...行区切り文字列として使用する文字列を返します。

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

csv = CSV.new("header1,header2|row1_1,row1_2", row_sep: "|")
csv.row_sep # => "|"
csv.read # => [["header1", "header2"], ["row1_1", "row1_2"]]
//}

@see CSV.new...

CGI#out(options = "text/html") { .... } (119.0)

HTTP ヘッダと、ブロックで与えられた文字列を標準出力に出力します。

...、language を "ja"にします。

@param options Hash か文字列で HTTP ヘッダを生成するための情報を指定します。

例:
cgi = CGI.new
cgi.out{ "string" }
# Content-Type: text/html
# Content-Length: 6
#
# string...
...plain"){ "string" }
# Content-Type: text/plain
# Content-Length: 6
#
# string

cgi.out({"nph" => true,
"status" => "OK", # == "200 OK"
"server" => ENV['SERVER_SOFTWARE'],
"connection" =...
...Content-Type: text/html; charset=iso-2022-jp
"language" => "ja",
"expires" => Time.now + (3600 * 24 * 30),
"cookie" => [cookie1, cookie2],
"my_header1" => "my_value",
"my_header2" => "my_value"}){ "string"...

CSV::Row#to_csv -> String (119.0)

自身を CSV な文字列として返します。ヘッダは使用しません。

...自身を CSV な文字列として返します。ヘッダは使用しません。

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

row = CSV::Row.new(["header1", "header2"], [1, 2])
row.to_csv # => "1,2\n"
row.to_csv( {col_sep: "|", row_sep: "<br>"} ) # => "1|2<br>"
//}...

CSV::Row#to_s -> String (119.0)

自身を CSV な文字列として返します。ヘッダは使用しません。

...自身を CSV な文字列として返します。ヘッダは使用しません。

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

row = CSV::Row.new(["header1", "header2"], [1, 2])
row.to_csv # => "1,2\n"
row.to_csv( {col_sep: "|", row_sep: "<br>"} ) # => "1|2<br>"
//}...

絞り込み条件を変える

CSV#each {|row| ... } -> nil (113.0)

各行に対してブロックを評価します。

...[例 CSV.new 時に :header => true を指定した場合][ruby]{
require "csv"

users = <<CSV
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
csv = CSV.new(users, headers: true)
csv.each do |row|
p row
end

# => #<CSV::Row "id":"1" "first name":"ta...
...t name":"tanaka" "age":"20">
# => #<CSV::Row "id":"2" "first name":"jiro" "last name":"suzuki" "age":"18">
# => #<CSV::Row "id":"3" "first name":"ami" "last name":"sato" "age":"19">
# => #<CSV::Row "id":"4" "first name":"yumi" "last name":"adachi" "age":"21">
//}

//emlist[例 CSV.new 時に :header...
...[ruby]{
require "csv"

users = <<CSV
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
csv = CSV.new(users)
csv.each do |row|
p row
end

# => ["id", "first name", "last name", "age"]
# => ["1", "taro", "tanaka", "20"]
# => ["2", "jiro", "suzuki", "18"...

CSV#quote_char -> String (113.0)

フィールドをクオートするのに使用する文字列を返します。

...フィールドをクオートするのに使用する文字列を返します。

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

csv = CSV.new("header1,header2\nrow1_1,row1_2", quote_char: "'")
csv.quote_char # => "'"
//}

@see CSV.new...
<< < ... 19 20 21 >>