summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/open-uri.rb4
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c930d8d11f..18597f3a53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Jul 23 22:48:19 2012 Tanaka Akira <akr@fsij.org>
+
+ * lib/open-uri.rb: use respond_to? to test Tempfile.
+ [ruby-dev:45995] [Bug #6781] reported by hsbt (Hiroshi SHIBATA).
+
Mon Jul 23 14:43:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (LIBPATHENV): LIBPATH is used on AIX, but not
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index 07034654a2..7f2a056370 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -149,8 +149,8 @@ module OpenURI
begin
yield io
ensure
- if io.kind_of? Tempfile
- io.close!
+ if io.respond_to? :close!
+ io.close! # Tempfile
else
io.close
end