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

ruby-changes:26628

From: zzak <ko1@a...>
Date: Thu, 3 Jan 2013 14:59:37 +0900 (JST)
Subject: [ruby-changes:26628] zzak:r38679 (trunk): * lib/forwardable.rb (SingleForwardable): Fix example in overview

zzak	2013-01-03 14:59:27 +0900 (Thu, 03 Jan 2013)

  New Revision: 38679

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

  Log:
    * lib/forwardable.rb (SingleForwardable): Fix example in overview
      Patch by Vladimir Andrijevik [Github Fixes #231]

  Modified files:
    trunk/ChangeLog
    trunk/lib/forwardable.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38678)
+++ ChangeLog	(revision 38679)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jan  3 14:58:00 2013  Zachary Scott  <zachary@z...>
+
+	* lib/forwardable.rb (SingleForwardable): Fix example in overview
+	  Patch by Vladimir Andrijevik [Github Fixes #231]
+
 Thu Jan  3 14:32:47 2013  Yuki Yugui Sonoda  <yugui@y...>
 
 	* configure.in (OBJCOPY):  Fixes build error for NativeClient.
Index: lib/forwardable.rb
===================================================================
--- lib/forwardable.rb	(revision 38678)
+++ lib/forwardable.rb	(revision 38679)
@@ -196,17 +196,21 @@ end https://github.com/ruby/ruby/blob/trunk/lib/forwardable.rb#L196
 #    printer.def_delegator "STDOUT", "puts"  # add delegation for STDOUT.puts()
 #    printer.puts "Howdy!"
 #
-# Also, SingleForwardable can be use to Class or Module.
+# Also, SingleForwardable can be used to set up delegation for a Class or Module.
 #
-#    module Facade
-#      extend SingleForwardable
-#      def_delegator :Implementation, :service
-#
-#      class Implementation
-#         def service...
-#      end
-#    end
+#   class Implementation
+#     def self.service
+#       puts "serviced!"
+#     end
+#   end
+#   
+#   module Facade
+#     extend SingleForwardable
+#     def_delegator :Implementation, :service
+#   end
 #
+#   Facade.service #=> serviced!
+#   
 # If you want to use both Forwardable and SingleForwardable, you can
 # use methods def_instance_delegator and def_single_delegator, etc.
 module SingleForwardable

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

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