るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.042秒)
トップページ > クエリ:nil[x] > クエリ:end[x] > クエリ:notify[x]

別のキーワード

  1. _builtin nil?
  2. nilclass nil?
  3. object nil?
  4. _builtin nil
  5. object nil

ライブラリ

クラス

検索結果

Rinda::TupleSpace#notify(event, pattern, sec = nil) -> Rinda::NotifyTemplateEntry (18332.0)

event で指定した種類のイベントの監視を開始します。

...トが生じた場合、
このメソッドの返り値の Rinda::NotifyTemplateEntry を経由し、
Rinda::NotifyTemplateEntry#each を用いて報告を受け取ります。

sec で監視期間を秒数で指定できます。 nil で無限に監視し続けます。

event として以下の3...
...
require 'rinda/tuplespace'

tuplespace = Rinda::TupleSpace.new
observer = tuplespace.notify("write", ["xyz", nil, nil])
Therad.new do
observer.each{|event, tuple| p event, tuple }
end


tuplespace.write(["xyz", 0, 1])
tuplespace.write(["pqr", 0, 1])
tuplespace.write(["xy...

Observable (120.0)

Observer パターンを提供するモジュールです。

...ドにより更新フラグを立て、
Observable#notify_observers が呼び出されると
更新フラグが立っている場合はオブザーバに通知します
(オブザーバの update メソッドを呼び出す)。
Observable#notify_observers の引数は
そのままオブザーバの...
...@symbol = symbol
end


def run
last_price = nil
loop do
price = Price.fetch(@symbol)
print "Current price: #{price}\n"
if price != last_price
changed # notify observers
last_price = price
notify
_observers(Time....
...now, price)
end
sleep 1
end

end

end


class Price ### A mock class to fetch a stock price (60 - 140).
def self.fetch(symbol)
60 + rand(80)
end

end


class Warner ### An abstract observer of Ticker objects.
def initialize(ticker, li...