ライブラリ
- csv (33)
- nkf (11)
-
rexml
/ document (44) -
ripper
/ filter (11) - shell (24)
-
shell
/ command-processor (24) -
shell
/ filter (108) - uri (22)
クラス
- CSV (33)
-
REXML
:: Text (44) - Shell (24)
-
Shell
:: CommandProcessor (24) -
Shell
:: Filter (108) -
URI
:: LDAP (22)
キーワード
- < (6)
- > (6)
- >> (6)
- Filter (11)
-
NEWS for Ruby 2
. 7 . 0 (5) - NKF (11)
- [] (6)
- build (22)
- cat (18)
- each (6)
- echo (18)
- foreach (6)
- glob (18)
- mkdir (6)
- new (11)
- out (6)
-
ruby 1
. 6 feature (11) - system (6)
- tee (18)
- test (6)
-
test
/ unit (1) -
to
_ a (6) -
to
_ s (17) - tracer (11)
- transact (6)
- unnormalize (11)
- value (11)
- | (6)
検索結果
先頭5件
-
CSV
. filter(input , options = Hash . new) {|row| . . . } (24227.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築
するのに便利です。
与えられたブロックに一行ずつ渡されます。ブロックに渡された行は必要であ
れば変更することができます。ブロックの評......ルト値は $/ です。
//emlist[例: input, output は初期値][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 << "he......//emlist[例: input, output を指定する][ruby]{
require "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.o... -
CSV
. filter(input , output , options = Hash . new) {|row| . . . } (24227.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築
するのに便利です。
与えられたブロックに一行ずつ渡されます。ブロックに渡された行は必要であ
れば変更することができます。ブロックの評......ルト値は $/ です。
//emlist[例: input, output は初期値][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 << "he......//emlist[例: input, output を指定する][ruby]{
require "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.o... -
CSV
. filter(options = Hash . new) {|row| . . . } (24227.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築
するのに便利です。
与えられたブロックに一行ずつ渡されます。ブロックに渡された行は必要であ
れば変更することができます。ブロックの評......ルト値は $/ です。
//emlist[例: input, output は初期値][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 << "he......//emlist[例: input, output を指定する][ruby]{
require "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.o... -
Ripper
:: Filter (12018.0) -
イベントドリブンスタイルで Ruby プログラムを加工するためのクラスです。
...=== 使用例
//emlist[][ruby]{
require 'ripper'
require 'cgi'
class Ruby2HTML < Ripper::Filter
def on_default(event, tok, f)
f << CGI.escapeHTML(tok)
end
def on_comment(tok, f)
f << %Q[<span class="comment">#{CGI.escapeHTML(tok)}</span>]
end
def on_tstring_beg(tok, f)
f......<< %Q[<span class="string">#{CGI.escapeHTML(tok)}]
end
def on_tstring_end(tok, f)
f << %Q[#{CGI.escapeHTML(tok)}</span>]
end
end
Ruby2HTML.new(ARGF).parse('')
//}
Ruby プログラムを解析して、Ripper::SCANNER_EVENTS にあるスキャナ
イベントを実行します。イベ... -
Shell
:: Filter # mkdir(*path) -> Array (9106.0) -
Dir.mkdirと同じです。 (複数可)
...Dir.mkdirと同じです。 (複数可)
@param path 作成するディレクトリ名を文字列で指定します。
@return 作成するディレクトリの一覧の配列を返します。
使用例
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
p sh.mkdir("foo") #=>... -
Shell
:: Filter # [](command , file1 , file2 = nil) -> bool | Time | Integer | nil (6406.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
...st や FileTest のメソッドに処理を委譲します。
@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。
@param file1 文......@param file2 文字列でファイルへのパスを指定します。
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p sh[?e, "foo"] # => true
p sh[:e, "foo"] # => true
p sh["e", "foo"] # => true
p sh[:exists?, "......foo"] # => true
p sh["exists?", "foo"] # => true
@see Kernel.#test, FileTest... -
Shell
:: Filter # test(command , file1 , file2 = nil) -> bool | Time | Integer | nil (6406.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
...st や FileTest のメソッドに処理を委譲します。
@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。
@param file1 文......@param file2 文字列でファイルへのパスを指定します。
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p sh[?e, "foo"] # => true
p sh[:e, "foo"] # => true
p sh["e", "foo"] # => true
p sh[:exists?, "......foo"] # => true
p sh["exists?", "foo"] # => true
@see Kernel.#test, FileTest... -
Shell
:: Filter # cat(*files) -> Shell :: Filter (6323.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...する Filter オブジェクトを返します.
@param files シェルコマンド cat に与えるファイル名を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp......!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}... -
Shell
:: Filter # tee(file) -> Shell :: Filter (6323.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...する Filter オブジェクトを返します.
@param file シェルコマンドtee に与えるファイル名を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!......cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}... -
Shell
:: Filter # |(filter) -> object (6271.0) -
パイプ結合を filter に対して行います。
...パイプ結合を filter に対して行います。
@param filter Shell::Filter オブジェクトを指定します。
@return filter を返します。
使用例
require 'shell'
Shell.def_system_command("tail")
Shell.def_system_command("head")
Shell.def_system_command("wc")
sh = Sh......ell.new
sh.transact {
i = 1
while i <= (cat("/etc/passwd") | wc("-l")).to_s.chomp.to_i
puts (cat("/etc/passwd") | head("-n #{i}") | tail("-n 1")).to_s
i += 1
end
}... -
Shell
:: Filter # echo(*strings) -> Shell :: Filter (6223.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...とする Filter オブジェクトを返します.
@param strings シェルコマンド echo に与える引数を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!......cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}... -
Shell
:: Filter # glob(pattern) -> Shell :: Filter (6223.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
..., それらを内容とする Filter オブジェクトを返します.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。
動作例
require 'shell'
Shell.def_system_......command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}
@see Dir.[]... -
REXML
:: Text . unnormalize(string , doctype = nil , filter = nil , illegal = nil) -> String (6219.0) -
string を非正規化(すべての entity をアンエスケープ)したものを 返します。
...string を非正規化(すべての entity をアンエスケープ)したものを
返します。
filter でアンエスケープしない実体の実体名を文字列配列で指定します。
@param string 非正規化する文字列
@param doctype DTD(REXML::DocType オブジェクト)
@par......am filter アンエスケープしない実体の実体名(文字列配列)
@param illegal 内部用。使わないでください。
//emlist[][ruby]{
require 'rexml/text'
REXML::Text.unnormalize("& &foobar; <") # => "& &foobar; <"
REXML::Text.unnormalize("< >", nil, ["lt"]) # => "<...