るりまサーチ

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

別のキーワード

  1. _builtin chomp
  2. string chomp!
  3. string chomp
  4. kernel chomp
  5. _builtin chomp!

ライブラリ

キーワード

検索結果

<< 1 2 > >>

String#chomp!(rs = $/) -> self | nil (18136.0)

self の末尾から rs で指定する改行コードを取り除きます。 ただし rs が "\n" ($/ のデフォルト値) のときは、 実行環境によらず "\r", "\r\n", "\n" のすべてを改行コードとみなして取り除きます。

...@return 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! # =>...
..."foo"
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!...
..."foo"
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!
@s...

Shell#cat(*files) -> Shell::Filter (6.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...ファイル名を文字列で指定します。

動作例
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 (6.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...与える引数を文字列で指定します。

動作例
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#glob(pattern) -> Shell::Filter (6.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...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.[]...

Shell#tee(file) -> Shell::Filter (6.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...るファイル名を文字列で指定します。

動作例
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 (6.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...ファイル名を文字列で指定します。

動作例
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 (6.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...与える引数を文字列で指定します。

動作例
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#glob(pattern) -> Shell::Filter (6.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...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.[]...

Shell::CommandProcessor#tee(file) -> Shell::Filter (6.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...るファイル名を文字列で指定します。

動作例
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 (6.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...ファイル名を文字列で指定します。

動作例
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 (6.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...与える引数を文字列で指定します。

動作例
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 (6.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...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.[]...

Shell::Filter#tee(file) -> Shell::Filter (6.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...るファイル名を文字列で指定します。

動作例
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"
}
}
}...

Syslog (6.0)

UNIXのsyslogのラッパーモジュール。 syslog の詳細については syslog(3) を参照してください。

...d seconds!", 100)
Syslog.close
# 書き込まれているか確かめる。
# 但し、実行環境によってログの場所が違う。くわしくはsyslog.confを参照。
File.foreach('/var/log/system.log'){|line|
line.chomp!
if /syslogtest/ =~ line
puts line
end
}...

Zlib::GzipReader#lineno -> Integer (6.0)

IO クラスの同名メソッドIO#linenoと同じです。

...lib::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...

絞り込み条件を変える

<< 1 2 > >>