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

ruby-changes:18450

From: tenderlove <ko1@a...>
Date: Thu, 6 Jan 2011 09:25:12 +0900 (JST)
Subject: [ruby-changes:18450] Ruby:r30473 (trunk): * lib/net/protocol.rb (eof?): BufferedIO should proxy eof? to the

tenderlove	2011-01-06 09:24:45 +0900 (Thu, 06 Jan 2011)

  New Revision: 30473

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

  Log:
    * lib/net/protocol.rb (eof?): BufferedIO should proxy eof? to the
      underlying IO object.

  Added files:
    trunk/test/net/http/test_buffered_io.rb
  Modified files:
    trunk/ChangeLog
    trunk/lib/net/protocol.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30472)
+++ ChangeLog	(revision 30473)
@@ -1,3 +1,8 @@
+Thu Jan  6 09:23:33 2011  Aaron Patterson <aaron@t...>
+
+	* lib/net/protocol.rb (eof?): BufferedIO should proxy eof? to the
+	  underlying IO object.
+
 Thu Jan  6 09:12:31 2011  Aaron Patterson <aaron@t...>
 
 	* lib/mkmf.rb (configuration): fixing gsub when multiple error flags
Index: lib/net/protocol.rb
===================================================================
--- lib/net/protocol.rb	(revision 30472)
+++ lib/net/protocol.rb	(revision 30473)
@@ -62,6 +62,10 @@
       "#<#{self.class} io=#{@io}>"
     end
 
+    def eof?
+      @io.eof?
+    end
+
     def closed?
       @io.closed?
     end
Index: test/net/http/test_buffered_io.rb
===================================================================
--- test/net/http/test_buffered_io.rb	(revision 0)
+++ test/net/http/test_buffered_io.rb	(revision 30473)
@@ -0,0 +1,17 @@
+require 'test/unit'
+require 'net/http'
+require 'stringio'
+
+require_relative 'utils'
+
+module Net
+  class TestBufferedIO < Test::Unit::TestCase
+    def test_eof?
+      s = StringIO.new
+      assert s.eof?
+      bio = BufferedIO.new(s)
+      assert_equal s, bio.io
+      assert_equal s.eof?, bio.eof?
+    end
+  end
+end

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

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