るりまサーチ

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

別のキーワード

  1. rss content=
  2. rss content
  3. net/imap content_id
  4. item content=
  5. items content=

ライブラリ

クラス

検索結果

CSV.filter(input, options = Hash.new) {|row| ... } (18233.0)

このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。

...ます。

@param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。

@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。

@param options ":in_", ":input_" で始まるキ...
...期値][ruby]{
# $ echo "header1,header2\nrow1_1,row1_2" > in.csv; ruby test.rb in.csv

require "csv"

options = { headers: true, return_headers: true, write_headers: true }

CSV.filter(options) do |row|
if row.header_row?
row << "header3"
next
end
row << "row1_3"
end

# => header1,hea...
...re "csv"
content =
<<EOS
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS

File.write('test.csv',content)
options = { headers: true, return_headers: true, write_headers: true }

CSV.filter(File.open("test.csv"), File.open("out.csv", "w"), options) do |...

CSV.filter(input, output, options = Hash.new) {|row| ... } (18233.0)

このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。

...ます。

@param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。

@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。

@param options ":in_", ":input_" で始まるキ...
...期値][ruby]{
# $ echo "header1,header2\nrow1_1,row1_2" > in.csv; ruby test.rb in.csv

require "csv"

options = { headers: true, return_headers: true, write_headers: true }

CSV.filter(options) do |row|
if row.header_row?
row << "header3"
next
end
row << "row1_3"
end

# => header1,hea...
...re "csv"
content =
<<EOS
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS

File.write('test.csv',content)
options = { headers: true, return_headers: true, write_headers: true }

CSV.filter(File.open("test.csv"), File.open("out.csv", "w"), options) do |...

CSV.filter(options = Hash.new) {|row| ... } (18233.0)

このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。

...ます。

@param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。

@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。

@param options ":in_", ":input_" で始まるキ...
...期値][ruby]{
# $ echo "header1,header2\nrow1_1,row1_2" > in.csv; ruby test.rb in.csv

require "csv"

options = { headers: true, return_headers: true, write_headers: true }

CSV.filter(options) do |row|
if row.header_row?
row << "header3"
next
end
row << "row1_3"
end

# => header1,hea...
...re "csv"
content =
<<EOS
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS

File.write('test.csv',content)
options = { headers: true, return_headers: true, write_headers: true }

CSV.filter(File.open("test.csv"), File.open("out.csv", "w"), options) do |...