別のキーワード
ライブラリ
- ビルトイン (11)
- shell (24)
-
shell
/ command-processor (24) -
shell
/ filter (24) - zlib (11)
クラス
- Shell (24)
-
Shell
:: CommandProcessor (24) -
Shell
:: Filter (24) - String (11)
-
Zlib
:: GzipReader (11)
検索結果
先頭5件
-
String
# chomp!(rs = $ / ) -> self | nil (18336.0) -
self の末尾から rs で指定する改行コードを取り除きます。 ただし rs が "\n" ($/ のデフォルト値) のときは、 実行環境によらず "\r", "\r\n", "\n" のすべてを改行コードとみなして取り除きます。
...self の末尾から rs で指定する改行コードを取り除きます。
ただし rs が "\n" ($/ のデフォルト値) のときは、
実行環境によらず "\r", "\r\n", "\n" のすべてを改行コードとみなして取り除きます。
rs に nil を指定した場合、この......eturn chomp! は通常 self を返しますが、取り除く改行がなかった場合は nil を返します。
//emlist[例][ruby]{
buf = "string\n"
buf.chomp! # => nil
p buf # => "string"
$/ = "\n" # デフォルトと同じ
p "foo\r".chomp! # => "foo"
p "foo\r\n".chomp! # => "fo......o"
p "foo\n".chomp! # => "foo"
p "foo\n\r".chomp! # => "foo\n"
buf = "string\n"
buf.chomp!(nil) # => nil
p buf # => "string\n"
p "foo\r\n\n".chomp!("") # => "foo"
p "foo\n\r\n".chomp!("") # => "foo"
p "foo\n\r\r".chomp!("") # => nil
//}
@see String#chomp
@see String#chop!......".chomp! # => "foo"
p "foo\n\r".chomp! # => "foo\n"
buf = "string\n"
buf.chomp!(nil) # => nil
p buf # => "string\n"
p "foo\r\n\n".chomp!("") # => "foo"
p "foo\n\r\n".chomp!("") # => "foo"
p "foo\n\r\r".chomp!("") # => nil
//}
@see String#chomp
@see String#chop!
@see String#dele... -
Zlib
:: GzipReader # lineno -> Integer (9224.0) -
IO クラスの同名メソッドIO#linenoと同じです。
...IO クラスの同名メソッドIO#linenoと同じです。
但し、gzip ファイル中に
エラーがあった場合 Zlib::Error 例外や
Zlib::GzipFile::Error 例外が発生します。
gzip ファイルのフッターの処理に注意して下さい。
gzip ファイルのフッターに......'zlib'
=begin
# hoge.gz がない場合は下記で作成できる。
Zlib::GzipWriter.open('hoge.gz') { |gz|
gz.puts 'h'
gz.puts 'o'
gz.puts 'g'
gz.puts 'e'
}
=end
Zlib::GzipReader.open('hoge.gz') { |gz|
while l = gz.gets
l.chomp!
printf "%s %d\n", l,......gz.lineno
end
}
#=> h 1
#=> o 2
#=> g 3
#=> e 4
@see IO#lineno... -
Shell
# glob(pattern) -> Shell :: Filter (6218.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...Filter オブジェクトを返します.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.n......ew
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}
@see Dir.[]... -
Shell
:: CommandProcessor # glob(pattern) -> Shell :: Filter (6218.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...Filter オブジェクトを返します.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.n......ew
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}
@see Dir.[]... -
Shell
:: Filter # glob(pattern) -> Shell :: Filter (6218.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...Filter オブジェクトを返します.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.n......ew
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}
@see Dir.[]... -
Shell
# cat(*files) -> Shell :: Filter (3218.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
# echo(*strings) -> Shell :: Filter (3218.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...lter オブジェクトを返します.
@param strings シェルコマンド echo に与える引数を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(fil......e).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}... -
Shell
# tee(file) -> Shell :: Filter (3218.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
:: CommandProcessor # cat(*files) -> Shell :: Filter (3218.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
:: CommandProcessor # echo(*strings) -> Shell :: Filter (3218.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...lter オブジェクトを返します.
@param strings シェルコマンド echo に与える引数を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(fil......e).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}... -
Shell
:: CommandProcessor # tee(file) -> Shell :: Filter (3218.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 # cat(*files) -> Shell :: Filter (3218.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 # echo(*strings) -> Shell :: Filter (3218.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...lter オブジェクトを返します.
@param strings シェルコマンド echo に与える引数を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(fil......e).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}... -
Shell
:: Filter # tee(file) -> Shell :: Filter (3218.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"
}
}
}...