[前][次][番号順一覧][スレッド一覧]

ruby-changes:30977

From: zzak <ko1@a...>
Date: Thu, 26 Sep 2013 22:09:19 +0900 (JST)
Subject: [ruby-changes:30977] zzak:r43056 (trunk): * lib/observer.rb: [DOC] syntax improvement in example by @chastell

zzak	2013-09-26 22:09:13 +0900 (Thu, 26 Sep 2013)

  New Revision: 43056

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43056

  Log:
    * lib/observer.rb: [DOC] syntax improvement in example by @chastell
      [Fixes GH-400] https://github.com/ruby/ruby/pull/400

  Modified files:
    trunk/ChangeLog
    trunk/lib/observer.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43055)
+++ ChangeLog	(revision 43056)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Sep 26 22:08:11 2013  Zachary Scott  <e@z...>
+
+	* lib/observer.rb: [DOC] syntax improvement in example by @chastell
+	  [Fixes GH-400] https://github.com/ruby/ruby/pull/400
+
 Thu Sep 26 22:03:15 2013  Zachary Scott  <e@z...>
 
 	* ext/digest/digest.c: [DOC] typo in overview by @chastell
Index: lib/observer.rb
===================================================================
--- lib/observer.rb	(revision 43055)
+++ lib/observer.rb	(revision 43056)
@@ -49,13 +49,13 @@ https://github.com/ruby/ruby/blob/trunk/lib/observer.rb#L49
 #     end
 #
 #     def run
-#       lastPrice = nil
+#       last_price = nil
 #       loop do
 #         price = Price.fetch(@symbol)
 #         print "Current price: #{price}\n"
-#         if price != lastPrice
+#         if price != last_price
 #           changed                 # notify observers
-#           lastPrice = price
+#           last_price = price
 #           notify_observers(Time.now, price)
 #         end
 #         sleep 1
@@ -64,7 +64,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/observer.rb#L64
 #   end
 #
 #   class Price           ### A mock class to fetch a stock price (60 - 140).
-#     def Price.fetch(symbol)
+#     def self.fetch(symbol)
 #       60 + rand(80)
 #     end
 #   end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]