ライブラリ
- English (22)
- ビルトイン (323)
- benchmark (11)
- continuation (11)
- coverage (7)
- csv (88)
- e2mmap (12)
- json (44)
-
minitest
/ unit (1) - mkmf (22)
-
net
/ http (176) -
net
/ imap (11) - openssl (22)
- optparse (68)
- rake (33)
-
rake
/ packagetask (11) - readline (11)
-
ripper
/ lexer (11) -
rubygems
/ dependency _ installer (22) -
rubygems
/ dependency _ list (11) - socket (55)
- tempfile (20)
- thread (14)
- thwait (6)
- timeout (19)
- tracer (22)
- tsort (21)
-
webrick
/ httpproxy (11) - win32ole (44)
クラス
- Array (11)
- BasicSocket (33)
- CSV (88)
- Coverage (7)
- Data (2)
-
Encoding
:: Converter (44) - Exception (44)
- Fiber (5)
-
Gem
:: DependencyInstaller (22) -
Gem
:: DependencyList (11) - IO (22)
- Method (11)
- Module (33)
-
Net
:: HTTP (143) -
Net
:: HTTPResponse (33) -
Net
:: IMAP (11) -
OpenSSL
:: SSL :: SSLContext (22) - OptionParser (68)
-
Rake
:: Application (11) -
Rake
:: PackageTask (11) - Ripper (11)
-
RubyVM
:: InstructionSequence (33) - Socket (11)
- Tempfile (20)
- Thread (11)
-
Thread
:: Queue (33) -
Thread
:: SizedQueue (33) - ThreadsWait (6)
- Tracer (22)
-
WEBrick
:: HTTPProxyServer (11) -
WIN32OLE
_ EVENT (33) -
WIN32OLE
_ TYPE (11)
モジュール
- Benchmark (11)
- Exception2MessageMapper (12)
- JSON (33)
-
JSON
:: Generator :: GeneratorMethods :: Object (11) - Kernel (88)
-
MiniTest
:: Assertions (1) - Rake (22)
- Readline (11)
- TSort (21)
- Timeout (19)
キーワード
-
$ ERROR _ INFO (11) -
$ ERROR _ POSITION (11) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - ConditionVariable (11)
- Continuation (11)
-
DEFAULT
_ OPTIONS (11) - Fail (6)
-
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) -
NEWS for Ruby 3
. 1 . 0 (3) - Raise (6)
- Rubyの起動 (11)
- TCPServer (11)
-
absolute
_ path (11) - append (11)
- application (11)
- application= (11)
-
assert
_ send (1) - autoload (22)
- autoload? (11)
- benchmark (11)
-
ca
_ file= (11) -
caller
_ locations (22) - cause (11)
- clone (11)
-
completion
_ proc= (11) -
connect
_ nonblock (11) -
const
_ source _ location (5) - create (20)
-
deconstruct
_ keys (2) -
default
_ event _ sources (11) - deq (22)
- disasm (11)
- disassemble (11)
- dump (11)
- dup (11)
-
each
_ strongly _ connected _ component (21) -
field
_ size _ limit (11) -
find
_ name (11) - generate (11)
- get (22)
- get2 (22)
- handler= (11)
- irb (11)
- lex (11)
- load (11)
-
module
_ function (12) - new (66)
-
next
_ wait (6) -
on
_ event (11) -
on
_ event _ with _ outargs (11) - open (44)
- parse (38)
- parse! (8)
-
pending
_ interrupt? (11) - pop (22)
- post (22)
- post2 (22)
-
primitive
_ convert (44) - raise (5)
-
read
_ body (22) - recvmsg (11)
- release (11)
-
renegotiation
_ cb= (11) -
request
_ get (22) -
request
_ post (22) -
rinda
/ rinda (11) -
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 3 feature (11) -
ruby 1
. 8 . 4 feature (11) -
ruby2
_ keywords (5) -
send
_ request (11) - sendmsg (11)
-
sendmsg
_ nonblock (11) -
set
_ backtrace (11) - shift (22)
-
source
_ location (11) - start (7)
- timeout (19)
-
to
_ json (11) -
to
_ s (11) -
try
_ convert (11) - tsort (11)
- unparse (11)
- value (11)
-
with
_ config (22) - 制御構造 (11)
検索結果
先頭5件
-
TSort
# each _ strongly _ connected _ component {|nodes| . . . } -> nil (18419.0) -
TSort#strongly_connected_components メソッドのイテレータ版です。 obj.each_strongly_connected_component は obj.strongly_connected_components.each に似ていますが、 ブロックの評価中に obj が変更された場合は予期しない結果になる ことがあります。
...TSort#strongly_connected_components メソッドのイテレータ版です。
obj.each_strongly_connected_component は
obj.strongly_connected_components.each に似ていますが、
ブロックの評価中に obj が変更された場合は予期しない結果になる
ことがあります。......each_strongly_connected_component は nil を返します。
//emlist[使用例][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
non_sort.e......ach_strongly_connected_component{|nodes|
p nodes
}
#出力
#=> [4]
#=> [2, 3]
#=> [1]
//}
@see TSort.each_strongly_connected_component... -
TSort
# each _ strongly _ connected _ component -> Enumerator (18319.0) -
TSort#strongly_connected_components メソッドのイテレータ版です。 obj.each_strongly_connected_component は obj.strongly_connected_components.each に似ていますが、 ブロックの評価中に obj が変更された場合は予期しない結果になる ことがあります。
...TSort#strongly_connected_components メソッドのイテレータ版です。
obj.each_strongly_connected_component は
obj.strongly_connected_components.each に似ていますが、
ブロックの評価中に obj が変更された場合は予期しない結果になる
ことがあります。......each_strongly_connected_component は nil を返します。
//emlist[使用例][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
non_sort.e......ach_strongly_connected_component{|nodes|
p nodes
}
#出力
#=> [4]
#=> [2, 3]
#=> [1]
//}
@see TSort.each_strongly_connected_component... -
Tracer
. on -> nil (18221.0) -
トレース出力を開始します。 ブロックを与えられた場合はそのブロック内のみトレース出力を行います。
...トレース出力を開始します。
ブロックを与えられた場合はそのブロック内のみトレース出力を行います。
require 'tracer'
Tracer.on
class Test
def test
b = 2
end
end
t = Test.new
t.test
@see Tracer.off... -
Tracer
. on { . . . } (18121.0) -
トレース出力を開始します。 ブロックを与えられた場合はそのブロック内のみトレース出力を行います。
...トレース出力を開始します。
ブロックを与えられた場合はそのブロック内のみトレース出力を行います。
require 'tracer'
Tracer.on
class Test
def test
b = 2
end
end
t = Test.new
t.test
@see Tracer.off... -
BasicSocket
# sendmsg _ nonblock(mesg , flags=0 , dest _ sockaddr=nil , *controls) -> Integer (12401.0) -
sendmsg(2) を用いてノンブロッキング方式でメッセージを送ります。
...sendmsg(2) を用いてノンブロッキング方式でメッセージを送ります。
詳しくは BasicSocket#sendmsg を見てください。
@return 送ったバイト数
@param mesg メッセージ文字列
@param flags フラグ(Socket::MSG_* という定数の bitwise OR を取ったも......の)
@param dest_sockaddr 通信先のアドレス
@param controls 補助データの配列
@see BasicSocket#sendmsg... -
Module
# const _ source _ location(name , inherited = true) -> [String , Integer] (12236.0) -
name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。
...らない場合は nil を返します。
定数は見つかったがソースファイルが見つからなかった場合は空の配列を返します。
//emlist[例][ruby]{
# test.rb:
class A # line 1
C1 = 1
C2 = 2
end
module M # line 6
C3 = 3
end
class B < A......C4 = 4
end
class A # 継続して A を定義する
C2 = 8 # 定数を再定義する
end
p B.const_source_location('C4') # => ["test.rb", 12]
p B.const_source_location('C3') # => ["test.rb", 7]
p B.const_source_location('C1') # => ["test.rb", 2]
p B.const_sourc......=> nil -- include したモジュールは検索しない
p A.const_source_location('C2') # => ["test.rb", 16] -- 最後に定義された位置を返す
p Object.const_source_location('B') # => ["test.rb", 10] -- Object はトップレベルの定数を検索する
p Object.const... -
Socket
# connect _ nonblock(server _ sockaddr) -> 0 (12218.0) -
ソケットをノンブロッキングモードに設定した後、 connect(2) を呼び出します。
...定した後、
connect(2) を呼び出します。
引数、返り値は Socket#connect と同じです。
connect が EINPROGRESS エラーを報告した場合、その例外(Errno::EINPROGRESS)
には IO::WaitWritable が Object#extend されます。
これを connect_nonblock をリトライ......Constants
socket = Socket.new(AF_INET, SOCK_STREAM, 0)
sockaddr = Socket.sockaddr_in(80, 'www.google.com')
begin # emulate blocking connect
socket.connect_nonblock(sockaddr)
rescue IO::WaitWritable
IO.select(nil, [socket]) # wait 3-way handshake completion
begin
socket.conn......ect_nonblock(sockaddr) # check connection failure
rescue Errno::EISCONN
end
end
socket.write("GET / HTTP/1.0\r\n\r\n")
results = socket.read
@param server_sockaddr 接続先アドレス
@raise Errno::EXXX connect(2) がエラーを報告した場合に発生します。詳しくは... -
Thread
:: ConditionVariable (12066.0) -
スレッドの同期機構の一つである状態変数を実現するクラスです。
...の一つである状態変数を実現するクラスです。
以下も ConditionVariable を理解するのに参考になります。
https://ruby-doc.com/docs/ProgrammingRuby/html/tut_threads.html#UF
=== Condition Variable とは
あるスレッド A が排他領域で動いていたとし......ex = Mutex.new
cv = ConditionVariable.new
a = Thread.start {
mutex.synchronize {
...
while (条件が満たされない)
cv.wait(mutex)
end
...
}
}
b = Thread.start {
mutex.synchronize {
# 上の......}
end
alias send enq
alias recv deq
end
if __FILE__ == $0
q = TinyQueue.new(1)
foods = 'Apple Banana Strawberry Udon Rice Milk'.split
l = []
th = Thread.new {
for obj in foods
q.send(obj)
print "sent ", obj, "\n"
end
q.send nil... -
Continuation (12012.0)
-
継続を表すクラスです。
...スです。
Kernel.#callcc { |cont| ... } の呼び出し
は、直前の状態(ローカル変数の定義、スタックフレーム)を cont に記憶
してブロックを実行します。cont は、Continuation クラスのインスタ
ンスで、Continuation#call メソッドを実行す......の戻り値を返しますが、Continuation#call(args)
が呼び出されたときは args を返します。
例:
以下は、Continuationによる無限ループの例
def LOOP
c = nil
yield callcc {|cnt| c = cnt; true }
c.call(false)
end
LOOP {|v| p v}
=> true......false
false
false
:
:
callcc とは、call-with-current-continuation の略です。... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize , options) -> Symbol (9518.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...coding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesiz......undefined_conversion
c = ec.primitive_errinfo[3].dup.force_encoding(ec.primitive_errinfo[1])
ec.insert_output('\x{%X:%s}' % [c.ord, c.encoding])
redo
when :incomplete_input
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
when :finished
end
break
end while nil
//}
不......正なバイトや変換先で未定義なバイトをエスケープしつつ変換する例です。以上のように、戻り値で分岐させつつ、Encoding::Converter#primitive_errinfo の情報を参照して処理していくことになります。...