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

ruby-changes:39145

From: nobu <ko1@a...>
Date: Mon, 13 Jul 2015 19:11:47 +0900 (JST)
Subject: [ruby-changes:39145] nobu:r51226 (trunk): timeout.rb: warn deprecated method

nobu	2015-07-13 19:11:38 +0900 (Mon, 13 Jul 2015)

  New Revision: 51226

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

  Log:
    timeout.rb: warn deprecated method
    
    * lib/timeout.rb (timeout): warn as deprecated for a long time.

  Modified files:
    trunk/ChangeLog
    trunk/NEWS
    trunk/lib/timeout.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51225)
+++ ChangeLog	(revision 51226)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Jul 13 19:11:35 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/timeout.rb (timeout): warn as deprecated for a long time.
+
 Mon Jul 13 01:37:27 2015  Zachary Scott  <zzak@r...>
 
         * ext/openssl/ossl.c: [DOC] Backport ruby/openssl@dbb3fdb [Bug #11345]
Index: lib/timeout.rb
===================================================================
--- lib/timeout.rb	(revision 51225)
+++ lib/timeout.rb	(revision 51226)
@@ -112,14 +112,9 @@ module Timeout https://github.com/ruby/ruby/blob/trunk/lib/timeout.rb#L112
   module_function :timeout
 end
 
-# Identical to:
-#
-#   Timeout::timeout(n, e, &block).
-#
-# This method is deprecated and provided only for backwards compatibility.
-# You should use Timeout#timeout instead.
-def timeout(n, e = nil, &block)
-  Timeout::timeout(n, e, &block)
+def timeout(*args, &block)
+  warn "#{caller_locations(1, 1)[0]}: Object##{__method__} is deprecated, use Timeout.timeout instead."
+  Timeout.timeout(*args, &block)
 end
 
 # Another name for Timeout::Error, defined for backwards compatibility with
Index: NEWS
===================================================================
--- NEWS	(revision 51225)
+++ NEWS	(revision 51226)
@@ -108,6 +108,9 @@ with all sufficient information, see the https://github.com/ruby/ruby/blob/trunk/NEWS#L108
   * IO#wait_readable no longer checks FIONREAD, it may be used for
     non-bytestream IO such as listen sockets.
 
+* timeout
+  * Object#timeout is now warned as deprecated when called.
+
 === Stdlib compatibility issues (excluding feature bug fixes)
 
 * lib/webrick/utils.rb

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

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