From b50d85ebc6962d8b86c22ec6a095ce4aeb7dd8e1 Mon Sep 17 00:00:00 2001 From: nagachika Date: Mon, 7 Feb 2011 14:01:01 +0000 Subject: [PATCH] * lib/benchmark.rb (Benchmark#bmbm): use ensure clause instead of Object#tap to restore STDOUT.sync. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/benchmark.rb | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b491d7290..1ea01e3e08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Feb 7 22:56:16 2011 CHIKANAGA Tomoyuki + + * lib/benchmark.rb (Benchmark#bmbm): use ensure clause instead of + Object#tap to restore STDOUT.sync. + Mon Feb 7 22:34:20 2011 Tanaka Akira * lib/net/http.rb (Net::HTTP#connect): support SNI (Server Name diff --git a/lib/benchmark.rb b/lib/benchmark.rb index 052b9add3b..ac17ba436d 100644 --- a/lib/benchmark.rb +++ b/lib/benchmark.rb @@ -266,9 +266,9 @@ module Benchmark GC.start print label.ljust(width) Benchmark.measure(&item).tap { |res| print res.format } - }.tap { - STDOUT.sync = sync } + ensure + STDOUT.sync = sync unless sync.nil? end #