Project

General

Profile

Misc #10791 ยป update_doc_for_observable.patch

gogotanaka (Kazuki Tanaka), 01/27/2015 07:43 PM

View differences:

lib/observer.rb
# def run
# last_price = nil
# loop do
# price = Price.fetch(@symbol)
# price = Price.fetch
# print "Current price: #{price}\n"
# if price != last_price
# changed # notify observers
......
# end
#
# class Price ### A mock class to fetch a stock price (60 - 140).
# def self.fetch(symbol)
# def self.fetch
# 60 + rand(80)
# end
# end
-
    (1-1/1)