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

ruby-changes:25435

From: glass <ko1@a...>
Date: Tue, 6 Nov 2012 17:08:58 +0900 (JST)
Subject: [ruby-changes:25435] glass:r37492 (trunk): * lib/tempfile.rb: fix confusing inspect.

glass	2012-11-06 17:06:21 +0900 (Tue, 06 Nov 2012)

  New Revision: 37492

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

  Log:
    * lib/tempfile.rb: fix confusing inspect.
      previous Tempfile#inspect says it is a File, but actually
      it is not a File.
    
        t = Tempfile.new("foo") #=> #<File:/tmp/foo20121106-31970-1ffbum0>
        t.is_a? File #=> false
    
      now Tempfile#inspect returns like:
    
        t = Tempfile.new("foo")
        #=> #<Tempfile:/tmp/foo20121106-31970-1ffbum0>

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37491)
+++ ChangeLog	(revision 37492)
@@ -1,3 +1,17 @@
+Tue Nov  6 16:50:00 2012  Masaki Matsushita  <glass.saga@g...>
+
+	* lib/tempfile.rb (Tempfile#inspect): fix confusing #inspect.
+	  previous Tempfile#inspect says it is a File, but actually
+	  it is not a File.
+
+	    t = Tempfile.new("foo") #=> #<File:/tmp/foo20121106-31970-1ffbum0>
+	    t.is_a? File #=> false
+
+	  now Tempfile#inspect returns like:
+
+	    t = Tempfile.new("foo")
+	    #=> #<Tempfile:/tmp/foo20121106-31970-1ffbum0>
+
 Tue Nov  6 16:22:30 2012  Naohisa Goto  <ngotogenome@g...>
 
 	* atomic.h: add #include <sys/atomic.h> for the workaround of
Index: lib/tempfile.rb
===================================================================
--- lib/tempfile.rb	(revision 37491)
+++ lib/tempfile.rb	(revision 37492)
@@ -261,6 +261,10 @@
   end
   alias length size
 
+  def inspect
+    "#<#{self.class}:#{path}>"
+  end
+
   # :stopdoc:
   class Remover
     def initialize(data)

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

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