11件ヒット
[1-11件を表示]
(0.054秒)
ライブラリ
- observer (11)
検索結果
先頭1件
-
Observable (25.0)
-
Observer パターンを提供するモジュールです。
...\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 se......price > @limit
print "+++ #{time.to_s}: Price above #@limit: #{price}\n"
end
end
end
ticker = Ticker.new("MSFT")
WarnLow.new(ticker, 80)
WarnHigh.new(ticker, 120)
ticker.run
# => Current price: 126
# => +++ 2017-11-02 12:09:36 +0900: Price above 120: 126
# => Curr...