Project

General

Profile

Misc #10791 ยป update_doc_for_observable.patch

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

View differences:

lib/observer.rb
52 52
#     def run
53 53
#       last_price = nil
54 54
#       loop do
55
#         price = Price.fetch(@symbol)
55
#         price = Price.fetch
56 56
#         print "Current price: #{price}\n"
57 57
#         if price != last_price
58 58
#           changed                 # notify observers
......
65 65
#   end
66 66
#
67 67
#   class Price           ### A mock class to fetch a stock price (60 - 140).
68
#     def self.fetch(symbol)
68
#     def self.fetch
69 69
#       60 + rand(80)
70 70
#     end
71 71
#   end
72
-