120件ヒット
[1-100件を表示]
(0.122秒)
ライブラリ
- csv (24)
- pathname (60)
-
rexml
/ document (12) - zlib (24)
クラス
-
CSV
:: Table (24) - Pathname (60)
-
REXML
:: Entity (12) -
Zlib
:: GzipWriter (24)
検索結果
先頭5件
-
Zlib
:: GzipWriter # write(*str) -> Integer (24136.0) -
自身に str を出力します。str が文字列でなけ れば to_s による文字列化を試みます。
...れば to_s による文字列化を試みます。
@param str 出力する文字列を指定します。文字列でない場合は to_s で文字列に変換します。
@return 実際に出力できたバイト数を返します。
require 'zlib'
filename='hoge1.gz'
fw = File.open(file......name, "w")
Zlib::GzipWriter.wrap(fw, Zlib::BEST_COMPRESSION){|gz|
gz.write "foo"
}
fr = File.open(filename)
Zlib::GzipReader.wrap(fr){|gz|
puts gz.read
}
#=> foo
@see IO#write... -
Zlib
:: GzipWriter # write(str) -> Integer (24136.0) -
自身に str を出力します。str が文字列でなけ れば to_s による文字列化を試みます。
...れば to_s による文字列化を試みます。
@param str 出力する文字列を指定します。文字列でない場合は to_s で文字列に変換します。
@return 実際に出力できたバイト数を返します。
require 'zlib'
filename='hoge1.gz'
fw = File.open(file......name, "w")
Zlib::GzipWriter.wrap(fw, Zlib::BEST_COMPRESSION){|gz|
gz.write "foo"
}
fr = File.open(filename)
Zlib::GzipReader.wrap(fr){|gz|
puts gz.read
}
#=> foo
@see IO#write... -
Pathname
# write(string , offset=nil , **opts) -> Integer (21220.0) -
...IO.write(self.to_s, string, offset, **opts)と同じです。
@see IO.write... -
REXML
:: Entity # to _ s -> String (18120.0) -
実体宣言を文字列化したものを返します。
...実体宣言を文字列化したものを返します。
@see REXML::Entity#write
//emlist[][ruby]{
e = REXML::ENTITY.new("w", "wee");
p e.to_s # => "<!ENTITY w \"wee\">"
//}... -
CSV
:: Table # to _ s(options = Hash . new) -> String (15226.0) -
CSV の文字列に変換して返します。
...す。オプションに :write_headers =>
false を指定するとヘッダを出力しません。
//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.to_csv # => "a,b,c\n1,2,3\n"
p table.to_csv(write_headers: false) # => "1,... -
Pathname
# binwrite(string , offset=nil) -> Integer (9117.0) -
IO.binwrite(self.to_s, *args)と同じです。
...IO.binwrite(self.to_s, *args)と同じです。
@see IO.binwrite... -
Zlib
:: GzipWriter # <<(str) -> self (6017.0) -
str を出力します。str が文字列でない場合は to_s を用いて 文字列に変換します。
...合は to_s を用いて
文字列に変換します。
@param str 出力したいオブジェクトを与えます。
require 'zlib'
filename='hoge1.gz'
fw = File.open(filename, "w")
Zlib::GzipWriter.wrap(fw, Zlib::BEST_COMPRESSION){|gz|
gz << "hoge" << "fuga"
}
fr = File.open(fi......lename)
Zlib::GzipReader.wrap(fr){|gz|
puts gz.read
}
#=> hogefuga
@see IO#<<... -
Pathname
# each _ line(*args) -> Enumerator (3059.0) -
IO.foreach(self.to_s, *args, &block) と同じです。
...reach(self.to_s, *args, &block) と同じです。
//emlist[例][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line
# => #<Enumerator: IO:foreach("testfile")>
//}
//emlist[例 ブロックを指定][ruby]{
require "pathname"
IO.write("testfile......", "line1\nline2,\nline3\n")
Pathname("testfile").each_line {|f| p f }
# => "line1\n"
# => "line2,\n"
# => "line3\n"
//}
//emlist[例 limit を指定][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(4) {|f| p f }
# => "line"
# => "1\n"
# =>......"line"
# => "2,\n"
# => "line"
# => "3\n"
//}
//emlist[例 sep を指定][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(",") {|f| p f }
# => "line1\nline2,"
# => "\nline3\n"
//}
@see IO.foreach... -
Pathname
# each _ line(*args) {|line| . . . } -> nil (3059.0) -
IO.foreach(self.to_s, *args, &block) と同じです。
...reach(self.to_s, *args, &block) と同じです。
//emlist[例][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line
# => #<Enumerator: IO:foreach("testfile")>
//}
//emlist[例 ブロックを指定][ruby]{
require "pathname"
IO.write("testfile......", "line1\nline2,\nline3\n")
Pathname("testfile").each_line {|f| p f }
# => "line1\n"
# => "line2,\n"
# => "line3\n"
//}
//emlist[例 limit を指定][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(4) {|f| p f }
# => "line"
# => "1\n"
# =>......"line"
# => "2,\n"
# => "line"
# => "3\n"
//}
//emlist[例 sep を指定][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(",") {|f| p f }
# => "line1\nline2,"
# => "\nline3\n"
//}
@see IO.foreach... -
Pathname
# ctime -> Time (3023.0) -
File.ctime(self.to_s) を渡したものと同じです。
...File.ctime(self.to_s) を渡したものと同じです。
//emlist[例][ruby]{
require 'pathname'
IO.write("testfile", "test")
pathname = Pathname("testfile")
pathname.ctime # => 2019-01-14 00:39:51 +0900
sleep 1
pathname.chmod(0755)
pathname.ctime # => 2019-01-14 00:39:52 +0900
//}
@see File.ct...