51件ヒット
[1-51件を表示]
(0.103秒)
検索結果
先頭5件
-
CSV
. filter(input , output , options = Hash . new) {|row| . . . } (24333.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...後に行を全て output に書き込
みます。
@param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。
@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。
@param......ます。
":out_", ":output_" で始まるキーは output にだけ適用されます。
それ以外のキーは両方に適用されます。
":output_row_sep" のデフォルト値は $/ です。
//emlist[例: input, output は初期値][ruby]{
# $......headers: true }
CSV.filter(options) do |row|
if row.header_row?
row << "header3"
next
end
row << "row1_3"
end
# => header1,header2,header3
# row1_1,row1_2,row1_3
//}
//emlist[例: input, output を指定する][ruby]{
require "csv"
content = <<EOS
id,first name,last name,age
1,taro,... -
Shell
:: Filter # out(dev = STDOUT , &block) -> () (24319.0) -
Shell#transact を呼び出しその結果を dev に出力します。
...hell#transact を呼び出しその結果を dev に出力します。
@param dev 出力先をIO オブジェクトなどで指定します。
@param block transact 内部で実行するシェルを指定します。
使用例:
require 'shell'
Shell.def_system_command("head")
sh = Shell.n......ew
File.open("out.txt", "w"){ |fp|
sh.out(fp) {
system("ls", "-l") | head("-n 3")
}
}... -
CSV
. filter(input , options = Hash . new) {|row| . . . } (24233.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...後に行を全て output に書き込
みます。
@param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。
@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。
@param......ます。
":out_", ":output_" で始まるキーは output にだけ適用されます。
それ以外のキーは両方に適用されます。
":output_row_sep" のデフォルト値は $/ です。
//emlist[例: input, output は初期値][ruby]{
# $......headers: true }
CSV.filter(options) do |row|
if row.header_row?
row << "header3"
next
end
row << "row1_3"
end
# => header1,header2,header3
# row1_1,row1_2,row1_3
//}
//emlist[例: input, output を指定する][ruby]{
require "csv"
content = <<EOS
id,first name,last name,age
1,taro,... -
CSV
. filter(options = Hash . new) {|row| . . . } (24233.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...後に行を全て output に書き込
みます。
@param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。
@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。
@param......ます。
":out_", ":output_" で始まるキーは output にだけ適用されます。
それ以外のキーは両方に適用されます。
":output_row_sep" のデフォルト値は $/ です。
//emlist[例: input, output は初期値][ruby]{
# $......headers: true }
CSV.filter(options) do |row|
if row.header_row?
row << "header3"
next
end
row << "row1_3"
end
# => header1,header2,header3
# row1_1,row1_2,row1_3
//}
//emlist[例: input, output を指定する][ruby]{
require "csv"
content = <<EOS
id,first name,last name,age
1,taro,... -
Shell
:: Filter # >(to) -> self (6112.0) -
toをフィルタの出力とする。 toが, 文字列ならばファイルに, IOオブジェクトであれ ばそれをそのまま出力とする。
...ルに,IOオブジェクトならばそれに出力します。
使用例
require 'shell'
Shell.def_system_command("tail")
sh = Shell.new
sh.transact {
(sh.tail("-n 3") < "/etc/passwd") > File.open("tail.out", "w")
#(sh.tail("-n 3") < "/etc/passwd") > "tail.out" # と同じ.
}... -
Shell
:: Filter # >>(to) -> self (6112.0) -
toをフィルタに追加する。 toが, 文字列ならばファイルに, IOオブジェクトであれば それをそのまま出力とする。
...IOオブジェクトならばそれに出力します。
使用例
require 'shell'
Shell.def_system_command("tail")
sh = Shell.new
sh.transact {
(sh.tail("-n 3") < "/etc/passwd") >> "tail.out"
#(sh.tail("-n 3") < "/etc/passwd") >> File.open("tail.out", "w") # でも同じ。
}...