From b0f2785d6c2bd99c39e634304164e343c7c5b4ae Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 13 Aug 2015 13:49:44 +0000 Subject: timeout.rb: freeze a string message * lib/timeout.rb (Timeout#timeout): freeze a string message to reduce string allocations. [Fix GH-996] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/timeout.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/timeout.rb') diff --git a/lib/timeout.rb b/lib/timeout.rb index 20a594898f..63a629923d 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -71,7 +71,7 @@ module Timeout # a module method, so you can call it directly as Timeout.timeout(). def timeout(sec, klass = nil) #:yield: +sec+ return yield(sec) if sec == nil or sec.zero? - message = "execution expired" + message = "execution expired".freeze e = Error bl = proc do |exception| begin -- cgit v1.2.3