別のキーワード
ライブラリ
- ビルトイン (602)
- csv (76)
-
net
/ http (72) - optparse (12)
- pathname (36)
- rake (132)
-
rake
/ packagetask (24) -
rexml
/ document (24) -
rubygems
/ installer (12) - socket (12)
- stringio (48)
- zlib (24)
クラス
- Array (4)
- CSV (48)
-
CSV
:: Table (24) - File (60)
-
File
:: Stat (12) -
Gem
:: Installer (12) - IO (478)
- Method (14)
- Module (12)
-
Net
:: HTTP (48) -
Net
:: HTTPResponse (24) - Object (12)
- OptionParser (12)
- Pathname (36)
- Proc (14)
-
REXML
:: DocType (12) -
REXML
:: Entity (12) -
Rake
:: Application (12) -
Rake
:: FileList (96) -
Rake
:: FileTask (12) -
Rake
:: PackageTask (24) - Socket (12)
- StringIO (48)
-
Zlib
:: GzipWriter (24)
モジュール
-
Rake
:: TaskManager (12)
キーワード
- << (26)
- >> (14)
-
add
_ loader (12) -
add
_ row (12) - atime (12)
-
attr
_ writer (12) - birthtime (12)
- clone (12)
- close (24)
-
close
_ read (12) -
close
_ write (12) - closed? (24)
- connect (12)
- ctime (24)
- display (12)
- dup (12)
- each (72)
-
each
_ byte (24) -
each
_ codepoint (24) -
each
_ line (96) - egrep (12)
-
excluded
_ from _ list? (12) - existing (12)
- existing! (12)
- ext (12)
-
external
_ encoding (12) - fcntl (12)
- finish (12)
- flock (12)
- get (24)
- gsub! (12)
- import (12)
-
internal
_ encoding (12) - load (12)
- mtime (12)
- needed? (12)
-
package
_ files (12) -
package
_ files= (12) - pos (12)
- pos= (12)
- post (24)
- pread (8)
- puts (12)
- pwrite (8)
-
read
_ body (24) - readbyte (12)
- readlines (36)
- reopen (60)
- resolve (12)
-
set
_ encoding _ by _ bom (6) - stat (12)
-
synthesize
_ file _ task (12) - syswrite (12)
- tell (12)
-
to
_ csv (16) -
to
_ s (24) - truncate (12)
-
write
_ headers? (12) -
write
_ spec (12)
検索結果
先頭5件
-
Module
# attr _ writer(*name) -> nil (6113.0) -
インスタンス変数 name への書き込みメソッド (name=) を定義します。
...タンス変数 name への書き込みメソッド (name=) を定義します。
このメソッドで定義されるメソッドの定義は以下の通りです。
//emlist[例][ruby]{
def name=(val)
@name = val
end
//}
@param name String または Symbol を 1 つ以上指定します。... -
Zlib
:: GzipWriter # close -> File (3013.0) -
フッターを書き出し、GzipWriter オブジェクトをクローズします。close と finish の違いは Zlib::GzipFile#close, Zlib::GzipFile#finish を 参照して下さい。
...フッターを書き出し、GzipWriter オブジェクトをクローズします。close と
finish の違いは Zlib::GzipFile#close, Zlib::GzipFile#finish を
参照して下さい。
注意: Ruby の finalizer の制約のため、GzipWriter オブジェクトは
必ずクローズしてく......h
filename='hoge1.gz'
gz = Zlib::GzipWriter.open(filename, 9)
gz.puts "hogehoge\n" * 100
f = gz.finish
p f.atime
# 例
#=> Sun Jul 06 15:43:57 +0900 2008
end
def case_close
filename='hoge1.gz'
gz = Zlib::GzipWriter.open(filename, 9)
gz.puts "hogehoge\n"... -
Zlib
:: GzipWriter # finish -> File (3013.0) -
フッターを書き出し、GzipWriter オブジェクトをクローズします。close と finish の違いは Zlib::GzipFile#close, Zlib::GzipFile#finish を 参照して下さい。
...フッターを書き出し、GzipWriter オブジェクトをクローズします。close と
finish の違いは Zlib::GzipFile#close, Zlib::GzipFile#finish を
参照して下さい。
注意: Ruby の finalizer の制約のため、GzipWriter オブジェクトは
必ずクローズしてく......h
filename='hoge1.gz'
gz = Zlib::GzipWriter.open(filename, 9)
gz.puts "hogehoge\n" * 100
f = gz.finish
p f.atime
# 例
#=> Sun Jul 06 15:43:57 +0900 2008
end
def case_close
filename='hoge1.gz'
gz = Zlib::GzipWriter.open(filename, 9)
gz.puts "hogehoge\n"... -
Array
# to _ csv(**options) -> String (97.0) -
CSV.generate_line(self, options) と同様です。
...す。
//emlist[][ruby]{
require 'csv'
p [1, 'Matz', :Ruby, Date.new(1965, 4, 14)].to_csv # => "1,Matz,Ruby,1965-04-14\n"
p [1, 'Matz', :Ruby, Date.new(1965, 4, 14)].to_csv(col_sep: ' ', row_sep: "\r\n") # => "1 Matz Ruby 1965-04-14\r\n"
//}
Ruby 3.0 (CSV 3.1.9)......うになりました。
//emlist[][ruby]{
require 'csv'
puts [1, nil].to_csv # => 1,
puts [1, nil].to_csv(write_nil_value: "N/A") # => 1,N/A
puts [2, ""].to_csv # => 2,""
puts [2, ""].to_csv(write_empty_value: "BLANK") # => 2,BLANK
//}... -
Pathname
# each _ line(*args) -> Enumerator (73.0) -
IO.foreach(self.to_s, *args, &block) と同じです。
...ck) と同じです。
//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")......例 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\n... -
Pathname
# each _ line(*args) {|line| . . . } -> nil (73.0) -
IO.foreach(self.to_s, *args, &block) と同じです。
...ck) と同じです。
//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")......例 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\n... -
IO
# each(limit , chomp: false) -> Enumerator (55.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...除きます。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno......is is line three,\n"
# "4: And so on..."
//}
//emlist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lin......# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,"
# "3: And so on."
# "4: .."
//}
//emlist[例: chomp = true][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "... -
IO
# each(limit , chomp: false) {|line| . . . } -> self (55.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...除きます。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno......is is line three,\n"
# "4: And so on..."
//}
//emlist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lin......# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,"
# "3: And so on."
# "4: .."
//}
//emlist[例: chomp = true][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "... -
IO
# each(rs = $ / , chomp: false) -> Enumerator (55.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...除きます。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno......is is line three,\n"
# "4: And so on..."
//}
//emlist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lin......# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,"
# "3: And so on."
# "4: .."
//}
//emlist[例: chomp = true][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "... -
IO
# each(rs = $ / , chomp: false) {|line| . . . } -> self (55.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...除きます。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno......is is line three,\n"
# "4: And so on..."
//}
//emlist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lin......# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,"
# "3: And so on."
# "4: .."
//}
//emlist[例: chomp = true][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "... -
IO
# each(rs , limit , chomp: false) -> Enumerator (55.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...除きます。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno......is is line three,\n"
# "4: And so on..."
//}
//emlist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lin......# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,"
# "3: And so on."
# "4: .."
//}
//emlist[例: chomp = true][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "...