るりまサーチ

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

別のキーワード

  1. _builtin end
  2. ripper end_seen?
  3. _builtin exclude_end?
  4. _builtin end_with?
  5. io seek_end

ライブラリ

検索結果

Observable (38120.0)

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

...ジュールです。

Mix-in により Observer パターンを提供します。

Observable
モジュールを include したクラスは
Observable
#changed メソッドにより更新フラグを立て、
Observable
#notify_observers が呼び出されると
更新フラグが立っている場...
...ッドを呼び出す)。
Observable
#notify_observers の引数は
そのままオブザーバの update メソッドに渡されます。

=== サンプルコード
require "observer"

class Ticker ### Periodically fetch a stock price.
include Observable

def initialize(symbol)...
...ice = 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 T...