るりまサーチ

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

別のキーワード

  1. tuple notify
  2. shell notify
  3. observer notify_observers
  4. observable notify_observers
  5. tuplespace notify

ライブラリ

モジュール

検索結果

Observable#notify_observers(*arg) -> nil (18131.0)

オブザーバへ更新を通知します。

...合は、
登録されているオブザーバの update メソッドを順次呼び出します。
与えられた引数はその update メソッドに渡されます。
与えられた引数の数と登録されているオブザーバのupdate メソッドの引数の数に違いがある場合...
...rgumentErrorを発生します。
全てのオブザーバの update メソッドを呼び出し後、更新フラグを初期化します。

@raise ArgumentError 与えられた引数の数と登録されているオブザーバのupdate メソッドの引数の数に違いがある場合に発生...

Observable (42.0)

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

...立て、
Observable#notify_observers が呼び出されると
更新フラグが立っている場合はオブザーバに通知します
(オブザーバの update メソッドを呼び出す)。
Observable#notify_observers の引数は
そのままオブザーバの update メソッドに渡さ...
...rrent 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 (...
...end
end

class WarnLow < Warner
def update(time, price) # callback for observer
if price < @limit
print "--- #{time.to_s}: Price below #@limit: #{price}\n"
end
end
end

class WarnHigh < Warner
def update(time, price) # callback for observer...