るりまサーチ

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

別のキーワード

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

ライブラリ

モジュール

検索結果

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

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

...例外ArgumentErrorを発生します。
全てのオブザーバの update メソッドを呼び出し後、更新フラグを初期化します。

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

Observable (42.0)

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

...により更新フラグを立て、
Observable#notify_observers が呼び出されると
更新フラグが立っている場合はオブザーバに通知します
(オブザーバの update メソッドを呼び出す)。
Observable#notify_observers の引数は
そのままオブザーバの upd...
...
@
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
...
...ects.
def initialize(ticker, limit)
@
limit = limit
ticker.add_observer(self)
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...