クラス
- IO (264)
-
Zlib
:: GzipReader (180)
キーワード
- IO (12)
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 3
. 0 . 0 (5) - NKF (12)
- Rubyの起動 (12)
- bigdecimal (12)
- each (24)
-
each
_ byte (24) -
each
_ line (24) - file (12)
- getc (12)
- lineno (12)
- lineno= (12)
- loop (20)
- pipe (96)
- popen (168)
- read (12)
- readchar (12)
- readline (12)
- readlines (12)
- rewind (12)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 2 feature (12) - timeout (21)
- 制御構造 (12)
検索結果
先頭5件
-
Zlib
:: GzipReader # gets(rs = $ / ) -> String | nil (18147.0) -
IO クラスの同名メソッドIO#getsと同じです。
...IO クラスの同名メソッドIO#getsと同じです。
但し、gzip ファイル中に
エラーがあった場合 Zlib::Error 例外や
Zlib::GzipFile::Error 例外が発生します。
gzip ファイルのフッターの処理に注意して下さい。
gzip ファイルのフッターに......* EOF (圧縮データの最後) を越えて読み込み要求を受けた時。
すなわち Zlib::GzipReader#read,
Zlib::GzipReader#gets メソッド等が nil を返す時。
* EOF まで読み込んだ後、Zlib::GzipFile#close メソッドが
呼び出された時。
* EOF......を参照
require 'zlib'
=begin
# hoge.gz がない場合は下記で作成できる。
Zlib::GzipWriter.open('hoge.gz') { |gz|
gz.puts 'hoge'
gz.puts 'fuga'
}
=end
Zlib::GzipReader.open('hoge.gz') { |gz|
while l = gz.gets
puts l
end
}
#=> hoge
#=> fuga... -
ruby 1
. 6 feature (72.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...=> ruby 1.6.7 (2002-03-01) [i586-linux]
true
=> ruby 1.6.7 (2002-08-21) [i586-linux]
false
# : 2002-08-01 IO#read, gets ..., etc.
#
# File::NONBLOCK を指定した IO の読み込みで EWOULDBLOCK が発生すると、
# 途中まで読んだデータが失......シグナルを送らないと終了しない不具合が修正さ
れました。((<ruby-bugs-ja:PR#223>))
trap(:TERM, "EXIT")
END{
puts "exit"
}
Thread.start { Thread.stop }
sleep
: 2002-04-17: Regexp#inspect
((<ruby-bugs-ja:PR#222>))
p %r{\/}
=> ruby 1......def _ptr() Ptr.new(self) end
end
def foo(int)
int[] += 1
end
x = 1._ptr
foo(x)
puts x[]
=> -:11: [BUG] Segmentation fault
ruby 1.6.5 (2001-09-19) [i586-linux]
=> -:11:in `[]=': wrong # of arguments... -
Zlib
:: GzipReader # rewind -> 0 (48.0) -
ファイルポインタを Zlib::GzipReader.new を呼び出した直後の 時点に戻します。関連付けられている IO オブジェクトに seek メソッドが定義されている必要があります。
...=begin
# hoge.gz がない場合はこれで作成する。
Zlib::GzipWriter.open('hoge.gz') { |gz|
gz.puts 'hoge'
gz.puts 'fuga'
}
=end
gz = Zlib::GzipReader.open('hoge.gz')
puts gz.gets #=> hoge
puts gz.gets #=> fuga
gz.rewind #=> 0
puts gz.gets #=> hoge
gz.close... -
IO
. popen("-" , mode = "r" , opt={}) -> IO (46.0) -
第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。
...ロセスでは
nil を返します。
io = IO.popen("-", "r+")
if io # parent
io.puts "foo"
p io.gets # => "child output: foo\n"
io.close
else # child
s = gets
print "child output: " + s
exit
end
ブロックを与えられた場合、親プ......引数にブロックを実行し終了します。
p IO.popen("-", "r+") {|io|
if io # parent
io.puts "foo"
io.gets
else # child
s = gets
puts "child output: " + s
end
}
# => "child output: foo\n"
opt ではエンコーディングの設定やプ... -
IO
. popen("-" , mode = "r" , opt={}) {|io| . . . } -> object (46.0) -
第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。
...ロセスでは
nil を返します。
io = IO.popen("-", "r+")
if io # parent
io.puts "foo"
p io.gets # => "child output: foo\n"
io.close
else # child
s = gets
print "child output: " + s
exit
end
ブロックを与えられた場合、親プ......引数にブロックを実行し終了します。
p IO.popen("-", "r+") {|io|
if io # parent
io.puts "foo"
io.gets
else # child
s = gets
puts "child output: " + s
end
}
# => "child output: foo\n"
opt ではエンコーディングの設定やプ... -
IO
. popen(env , "-" , mode = "r" , opt={}) -> IO (46.0) -
第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。
...ロセスでは
nil を返します。
io = IO.popen("-", "r+")
if io # parent
io.puts "foo"
p io.gets # => "child output: foo\n"
io.close
else # child
s = gets
print "child output: " + s
exit
end
ブロックを与えられた場合、親プ......引数にブロックを実行し終了します。
p IO.popen("-", "r+") {|io|
if io # parent
io.puts "foo"
io.gets
else # child
s = gets
puts "child output: " + s
end
}
# => "child output: foo\n"
opt ではエンコーディングの設定やプ... -
IO
. popen(env , "-" , mode = "r" , opt={}) {|io| . . . } -> object (46.0) -
第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。
...ロセスでは
nil を返します。
io = IO.popen("-", "r+")
if io # parent
io.puts "foo"
p io.gets # => "child output: foo\n"
io.close
else # child
s = gets
print "child output: " + s
exit
end
ブロックを与えられた場合、親プ......引数にブロックを実行し終了します。
p IO.popen("-", "r+") {|io|
if io # parent
io.puts "foo"
io.gets
else # child
s = gets
puts "child output: " + s
end
}
# => "child output: foo\n"
opt ではエンコーディングの設定やプ... -
bigdecimal (42.0)
-
bigdecimal は浮動小数点数演算ライブラリです。 任意の精度で 10 進表現された浮動小数点数を扱えます。
....txt", "r") do |file|
s = BigDecimal("0")
while line = file.gets
s = s + BigDecimal(line)
end
puts s # => 0.3e0
end
File::open("digits.txt", "r") do |file|
s = 0
while line = file.gets
s = s + line.to_f
end
puts s # => 0.30000000000000004
end
//}
2 進数で計算する......)
u = t.div(k,sig)
pi = pi + u
k = k + two
end
pi
end
if $0 == __FILE__
if ARGV.size == 1
puts "PI("+ARGV[0]+"):"
puts big_pi(ARGV[0].to_i)
else
puts "TRY: ruby pi.rb 1000"
end
end
//}
=== その他
以下のメソッド以外にも、(C ではない) Ruby... -
ruby 1
. 8 . 2 feature (42.0) -
ruby 1.8.2 feature ruby 1.8.2 での ruby 1.8.1 からの変更点です。
...))
$ ruby1.8.1 -e "puts '# #{}'.inspect"
"# #{}"
$ ruby1.8.2 -e "puts '# #{}'.inspect"
"# \#{}"
: String#dump [ruby] [bug]
式展開にならない '#'がエスケープされないようになりました。
((<ruby-core:03922>))
$ ruby1.8.1 -e "puts '# #{}'.dump"
"\#......\#{}"
$ ruby1.8.2 -e "puts '# #{}'.dump"
"# \#{}"
=== 2004-12-08
: rss/rss [lib] [obsolete]
#item=/#set_item and so on are obsolete.
=== 2004-12-06
: Hash#hash [ruby] [new]
追加
((<ruby-talk:122482>))
Hash#hash は 2004-12-16 に削除されました。
((<ruby-dev:25206>......コマンドライン引数に与えたファイルを読んだ後には標準入力を読まなくなりました。
((<ruby-dev:24452>))
: IO#gets [ruby] [bug]
"\377" を引数に受け取っても適切に振舞うようになりました。((<ruby-dev:24460>))
: Dir.glob [change]
ブロ...