ライブラリ
クラス
- CSV (99)
-
CSV
:: Table (22) - IO (11)
- Method (6)
-
Net
:: HTTPResponse (22) - Proc (6)
-
Thread
:: Queue (33) -
Thread
:: SizedQueue (33) - ThreadsWait (60)
-
Zlib
:: GzipWriter (11)
オブジェクト
-
Readline
:: HISTORY (11)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - CSV (11)
- ERB (11)
-
NEWS for Ruby 2
. 1 . 0 (11) -
add
_ row (11) -
all
_ waits (18) - empty? (17)
- enq (22)
- finished? (6)
- join (6)
-
join
_ nowait (6) - new (6)
-
next
_ wait (6) - open (44)
- push (33)
- puts (11)
-
read
_ body (22) - readline (11)
- readlines (22)
- readpartial (11)
- rss (11)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 3 feature (11) - threads (6)
- timeout (19)
検索結果
先頭5件
-
ThreadsWait
. new(*threads) -> ThreadsWait (3206.0) -
指定されたスレッドの終了をまつための、スレッド同期オブジェクトをつくります。
...をつくります。
@param threads 終了を待つスレッドを一つもしくは複数指定します。
使用例
require 'thwait'
threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
thall = ThreadsWait.new(*threads)
thall.all_waits{|th|
pr......#=> #<Thread:0x214bc run>
#=> #<Thread:0x21548 run>
#=> #<Thread:0x215d4 run>
#=> #<Thread:0x21660 run>
#=> #<Thread:0x21430 run>
#=> end #<Thread:0x214bc dead>
#=> end #<Thread:0x21548 dead>
#=> end #<Thread:0x215d4 dead>
#=> end #<Thread:0x21660 dead>
#=> end #<Thread:0x21430 d... -
ThreadsWait
# join(*threads) -> () (3106.0) -
終了を待つスレッドの対象として、threads で指定されたスレッドを指定します。
...threads で指定されたスレッドを指定します。
@param threads 複数スレッドの終了を待つスレッドに指定されたthreadsを加えます。
require 'thwait'
threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
thall = ThreadsWai......t.new
p thall.threads #=> []
thall.join(*threads)
p thall.threads
#=> [#<Thread:0x216ec dead>, #<Thread:0x21660 dead>, #<Thread:0x215d4 dead>, #<Thread:0x214bc dead>]... -
ThreadsWait
# join _ nowait(*threads) -> () (3106.0) -
終了を待つスレッドの対象として、threads で指定されたスレッドを指定します。 しかし、実際には終了をまちません。
...、threads で指定されたスレッドを指定します。
しかし、実際には終了をまちません。
@param threads 複数スレッドの終了を待つスレッドに指定されたthreadsを加えます。
require 'thwait'
threads = []
5.times {|i|
threads << Thread.new......{ sleep 1; p Thread.current }
}
thall = ThreadsWait.new
p thall.threads #=> []
thall.join_nowait(*threads)
p thall.threads #=> [#<Thread:0x21638 sleep>, #<Thread:0x215ac sleep>, #<Thread:0x21520 sleep>, #<Thread:0x21494 sleep>, #<Thread:0x21408 sleep>]
# 実際には終了を待って... -
ThreadsWait
# next _ wait(nonblock = nil) -> Thread (3106.0) -
指定したスレッドのどれかが終了するまで待ちます。
...ThreadsWait::ErrNoFinishedThread が発生します。
@raise ErrNoWaitingThread 終了をまつスレッドが存在しない時、発生します。
@raise ErrNoFinishedThread nonblock がtrue でかつ、キューが空の時、発生します。
#使用例
require 'thwait'
threads = [......]
2.times {|i|
threads << Thread.new { sleep i }
}
thall = ThreadsWait.new
thall.join_nowait(*threads)
until thall.empty?
th = thall.next_wait
p th
end
@see Queue#pop... -
ThreadsWait
. all _ waits(*threads) -> () (3106.0) -
指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。
...クを評価します。
@param threads 終了するまでまつスレッドを一つもしくは複数指定します。
require 'thwait'
threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
ThreadsWait.all_waits(*threads) {|th| printf("end %s\n", th.insp......#<Thread:0x21584 run>
#=> #<Thread:0x21610 run>
#=> #<Thread:0x2169c run>
#=> #<Thread:0x21728 run>
#=> #<Thread:0x214f8 run>
#=> end #<Thread:0x21584 dead>
#=> end #<Thread:0x21610 dead>
#=> end #<Thread:0x2169c dead>
#=> end #<Thread:0x21728 dead>
#=> end #<Thread:0x214f8 dead>... -
CSV
# add _ row(row) -> self (3024.0) -
自身に row を追加します。
...定][ruby]{
require "csv"
File.write("test.csv", <<CSV)
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
CSV.open("test.csv", "a") do |csv|
csv.puts(["5", "saburo", "kondo", "34"])
end
print File.read("test.csv")
# => id,first name,last name,age
#......e("test.csv", <<CSV)
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
CSV.open("test.csv", "a") do |csv|
row = CSV::Row.new(["id", "first name", "last name", "age"], ["5", "saburo", "kondo", "34"])
csv.add_row(row)
end
print File.read("test.csv")... -
CSV
# puts(row) -> self (3024.0) -
自身に row を追加します。
...定][ruby]{
require "csv"
File.write("test.csv", <<CSV)
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
CSV.open("test.csv", "a") do |csv|
csv.puts(["5", "saburo", "kondo", "34"])
end
print File.read("test.csv")
# => id,first name,last name,age
#......e("test.csv", <<CSV)
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
CSV.open("test.csv", "a") do |csv|
row = CSV::Row.new(["id", "first name", "last name", "age"], ["5", "saburo", "kondo", "34"])
csv.add_row(row)
end
print File.read("test.csv")... -
ThreadsWait
# all _ waits -> () (3006.0) -
指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。
...thwait'
threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
thall = ThreadsWait.new(*threads)
thall.all_waits{|th|
printf("end %s\n", th.inspect)
}
# 出力例
#=> #<Thread:0x214bc run>
#=> #<Thread:0x21548 run>
#=> #<Thread:0x215d4 run>......#=> #<Thread:0x21660 run>
#=> #<Thread:0x21430 run>
#=> end #<Thread:0x214bc dead>
#=> end #<Thread:0x21548 dead>
#=> end #<Thread:0x215d4 dead>
#=> end #<Thread:0x21660 dead>
#=> end #<Thread:0x21430 dead>... -
ThreadsWait
# empty? -> bool (3006.0) -
同期されるスレッドが存在するならば true をかえします。
...ッドが存在するならば true をかえします。
使用例
require 'thwait'
threads = []
3.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
thall = ThreadsWait.new
p thall.threads.empty? #=> true
thall.join(*threads)
p thall.threads.empty? #=> false... -
ThreadsWait
# finished? -> bool (3006.0) -
すでに終了したスレッドが存在すれば true を返します。
...に終了したスレッドが存在すれば true を返します。
使用例
require 'thwait'
threads = []
3.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
thall = ThreadsWait.new(*threads)
p thall.finished? #=> false
sleep 3
p thall.finished? #=> true... -
ruby 1
. 8 . 3 feature (84.0) -
ruby 1.8.3 feature *((<ruby 1.8 feature>)) *((<ruby 1.8.2 feature>))
...body_exist? [lib] [obsolete]
: Net::HTTPResponse#response [lib] [obsolete]
: Net::HTTPResponse#header [lib] [obsolete]
: Net::HTTPResponse#read_header [lib] [obsolete]
obsolete になりました。VERBOSE モードの時、警告が出ます。
=== 2005-09-10
: OpenSSL::PKCS7::Recipi......ッドを呼び出すことは、$SAFE レベル が 0 のとき
禁止されるようになりました。
$ cat mthd_taint.rb
th = Thread.new{
$SAFE = 3
class Hoge
def foo
puts "safe level: #{$SAFE}"
end
end
}
th.join
p $SAFE......05-05-16
: singleton class [ruby] [change]
特異クラスは複製できなくなりました。((<ruby-talk:142749>))
$ ruby-1.8.3 -e 'class << "str"; self end.dup'
-e:1:in `initialize_copy': can't copy singleton class (TypeError)
from -e:1
=== 2005-05-15
: Pathname#unlink... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (60.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...自身であると定義されました
((<ruby-bugs-ja:313>))。なんだかよくわかりません(^^;
class << Object
p [self.id, self]
class << self
p [self.id, self]
end
end
=> ruby 1.6.7 (2002-03-01) [i586-linux]......そうです
((<ruby-bugs-ja:324>))。さあっぱりわかりません(^^;;
class << Object.new
class << self.superclass
p [self.id, self]
end
class << self
p [self.superclass.id, self.superclass]
end
end
=>......36703>))
: ((<IO#fsync|IO/fsync>)) [new]
追加
: ((<IO/IO.open>)) [new]
追加
: ((<IO/IO.for_fd>)) [new]
追加
: ((<IO/IO.read>)) [new]
追加。((<ruby-talk:9460>))が実装に至った経緯だと思う
=== LocalJumpError
: ((<LocalJumpError#exit_value|LocalJ... -
CSV (60.0)
-
このクラスは CSV ファイルやデータに対する完全なインターフェイスを提供します。
...]{
require "csv"
csv_text = <<~CSV_TEXT
Ruby,1995
Rust,2010
CSV_TEXT
IO.write "sample.csv", csv_text
# ファイルから一行ずつ
CSV.foreach("sample.csv") do |row|
p row
end
# => ["Ruby", "1995"]
# ["Rust", "2010"]
# ファイルから一度に
p CSV.read("sample.csv")
# => [["Ruby......き込み
CSV.open("path/to/file.csv", "wb") do |csv|
csv << ["row", "of", "CSV", "data"]
csv << ["another", "row"]
# ...
end
# 文字列へ書き込み
csv_string = CSV.generate do |csv|
csv << ["row", "of", "CSV", "data"]
csv << ["another", "row"]
# ...
end
//}
=== 一行変換
//em......ット
//emlist[][ruby]{
require 'csv'
CSV { |csv_out| csv_out << %w{my data here} } # to $stdout
CSV(csv = "") { |csv_str| csv_str << %w{my data here} } # to a String
CSV($stderr) { |csv_err| csv_err << %w{my data here} } # to $stderr
//}
=== CSV と文字エンコーディ...