るりまサーチ

最速Rubyリファレンスマニュアル検索!
84件ヒット [1-84件を表示] (0.010秒)
トップページ > クエリ:push[x] > 種類:クラス[x]

別のキーワード

  1. _builtin push
  2. csv push
  3. row push
  4. array push
  5. queue push

ライブラリ

キーワード

検索結果

IRB::ExtendCommand::PushWorkspace (6017.0)

irb 中の irb_push_workspace コマンドのための拡張を定義したクラスです。

...irb 中の irb_push_workspace コマンドのための拡張を定義したクラスです。...

Psych::Stream (19.0)

入力されたオブジェクトから変換された YAML document を指定した IO に出力する機能を持つクラスです。

...持つクラスです。

start で変換を開始し、push で変換する Ruby オブジェクトを渡し、
最後に finish を呼ぶことで変換を完了します。
stream = Psych::Stream.new($stdout)
stream.start
stream.push({:foo => 'bar'})
stream.finish

YAML document は(バ...
...を確実に呼び出すためには Psych::Stream#start メソッドを
ブロック付きで呼び出すとよいでしょう。

stream = Psych::Stream.new($stdout)
stream.start do |em|
em.push(:foo => 'bar')
end

基本的な仕組みは Psych::Visitors::YAMLTree と似ています。...

Thread::ConditionVariable (19.0)

スレッドの同期機構の一つである状態変数を実現するクラスです。

...が空になった場合、
あるいは満タンになった場合に Condition Variable を使って wait しています。

require 'thread'

class
TinyQueue
def initialize(max=2)
@max = max
@full = ConditionVariable.new
@empty = ConditionVariable.new
@mutex = Mut...
...= []
end

def count
@q.size
end

def enq(v)
@mutex.synchronize{
@full.wait(@mutex) if count == @max
@q.push v
@empty.signal if count == 1
}
end

def deq
@mutex.synchronize{
@empty.wait(@mutex) if count == 0
v =...
...q.send(obj)
print "sent ", obj, "\n"
end
q.send nil
}

l.push th

th = Thread.new {
while obj = q.recv
print "recv ", obj, "\n"
end
}
l.push th

l.each do |t|
t.join
end
end

実行すると以下のように出力...

Thread::SizedQueue (13.0)

サイズの最大値を指定できる Thread::Queue です。

...れる行が同じ順序になります。
q = [] にすると入力と違った順序で行が出力されます。

require 'thread'

q = SizedQueue.new(1)

th = Thread.start {
while line = q.pop
print line
end
}

while l = gets
q.push(l)
end
q.push(l)

th.join...

Monitor (7.0)

スレッドの同期機構としてのモニター機能を提供するクラスです。 また同じスレッドから何度も lock できる Mutex としての機能も提供します。

...empty_cond.wait_while { buf.empty? }
print buf.shift
end
end
end

# producer
while line = ARGF.gets
mon.synchronize do
buf.push(line)
empty_cond.signal
end
end
//}

2回ロックしてもデッドロックにならない例です。

//emlist[デッドロックにな...

絞り込み条件を変える

TCPServer (7.0)

TCP/IP ストリーム型接続のサーバ側のソケットのクラスです。

...s on %s\n", addr.join(":"))

while true
nsock = select(socks)
next if nsock == nil
for s in nsock[0]
if s == gs
socks.push(s.accept)
print(s, " is accepted\n")
else
if s.eof?
print(s, " is gone\n")
s.close
socks.delete...

Thread::Queue (7.0)

Queue はスレッド間の FIFO(first in first out) の通信路です。ス レッドが空のキューを読み出そうとすると停止します。キューになんら かの情報が書き込まれると実行は再開されます。

...hread'

q = Queue.new

th1 = Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}

th1.join

実行すると以下のように出力します。

$ ruby que.rb
resource1
resource2
resource3...