96件ヒット
[1-96件を表示]
(0.091秒)
クラス
- IO (36)
-
Zlib
:: GzipWriter (48)
モジュール
- Kernel (12)
検索結果
先頭5件
-
Kernel
# file(*args) { . . . } -> Rake :: FileTask (27220.0) -
ファイルタスクを定義します。
...ル名と依存ファイル名を指定します。
例:
file "config.cfg" => ["config.template"] do
open("config.cfg", "w") do |outfile|
open("config.template") do |infile|
while line = infile.gets
outfile.puts line
end
end
end
end
@see R... -
IO
# reopen(path) -> self (6131.0) -
path で指定されたファイルにストリームを繋ぎ換えます。
...IO.write("testfile", "This is line one\nThis is line two\n")
f1 = File.new("testfile", "a+")
f2 = File.new("testfile")
f1.print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<File:testfile>
f2.readline......s # => ["This is line one\n", "This is line two\n", "This is line three\n"]
f2.close
//}
@see Kernel.#open... -
IO
# reopen(path , mode) -> self (6131.0) -
path で指定されたファイルにストリームを繋ぎ換えます。
...IO.write("testfile", "This is line one\nThis is line two\n")
f1 = File.new("testfile", "a+")
f2 = File.new("testfile")
f1.print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<File:testfile>
f2.readline......s # => ["This is line one\n", "This is line two\n", "This is line three\n"]
f2.close
//}
@see Kernel.#open... -
IO
# reopen(io) -> self (6106.0) -
自身を指定された io に繋ぎ換えます。
自身を指定された io に繋ぎ換えます。
クラスも io に等しくなることに注意してください。
IO#pos, IO#lineno などは指定された io と等しくなります。
@param io 自身を繋ぎ換えたい IO オブジェクトを指定します。
@raise IOError 指定された io が close されている場合に発生します。 -
Zlib
:: GzipWriter # print(*str) -> nil (31.0) -
引数を自身に順に出力します。引数を省略した場合は、$_ を出力します。
...トを指定します。
require 'zlib'
filename='hoge1.gz'
fw = File.open(filename, "w")
Zlib::GzipWriter.wrap(fw, Zlib::BEST_COMPRESSION){|gz|
gz.print "ugo"
}
fr = File.open(filename)
Zlib::GzipReader.wrap(fr){|gz|
puts gz.read
}
#=> ugo
@see IO#print, Kernel.#print... -
Zlib
:: GzipWriter # printf(format , *args) -> nil (31.0) -
C 言語の printf と同じように、format に従い引数 を文字列に変換して、自身に出力します。
...。
require 'zlib'
filename='hoge1.gz'
fw = File.open(filename, "w")
Zlib::GzipWriter.wrap(fw, Zlib::BEST_COMPRESSION){|gz|
gz.printf("\n%9s", "bar")
}
fr = File.open(filename)
Zlib::GzipReader.wrap(fr){|gz|
puts gz.read
}
#=> bar
@see IO#printf, Kernel.#printf... -
Zlib
:: GzipWriter # putc(ch) -> object (31.0) -
文字 ch を自身に出力します。
...require 'zlib'
filename='hoge1.gz'
fw = File.open(filename, "w")
Zlib::GzipWriter.wrap(fw, Zlib::BEST_COMPRESSION){|gz|
gz.putc ?u
gz.putc ?g
gz.putc ?o
}
fr = File.open(filename)
Zlib::GzipReader.wrap(fr){|gz|
puts gz.read
}
#=> ugo
@see IO#putc, Kernel.#putc... -
Zlib
:: GzipWriter # puts(*str) -> nil (31.0) -
各引数を自身に出力し、それぞれの後に改行を出力します。
...トを指定します。
require 'zlib'
filename='hoge1.gz'
fw = File.open(filename, "w")
Zlib::GzipWriter.wrap(fw, Zlib::BEST_COMPRESSION){|gz|
gz.puts "fuga"
}
fr = File.open(filename)
Zlib::GzipReader.wrap(fr){|gz|
puts gz.read
}
#=> fuga
@see IO#puts, Kernel.#puts...