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

ruby-changes:50622

From: kazu <ko1@a...>
Date: Fri, 16 Mar 2018 23:09:46 +0900 (JST)
Subject: [ruby-changes:50622] kazu:r62780 (trunk): sample/timeout.rb: fix warnings

kazu	2018-03-16 23:09:40 +0900 (Fri, 16 Mar 2018)

  New Revision: 62780

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

  Log:
    sample/timeout.rb: fix warnings
    
    warning: Object#timeout is deprecated, use Timeout.timeout instead.
    [ci skip]

  Modified files:
    trunk/sample/timeout.rb
Index: sample/timeout.rb
===================================================================
--- sample/timeout.rb	(revision 62779)
+++ sample/timeout.rb	(revision 62780)
@@ -5,27 +5,27 @@ def progress(n = 5) https://github.com/ruby/ruby/blob/trunk/sample/timeout.rb#L5
   puts "never reach"
 end
 
-p timeout(5) {
+p Timeout.timeout(5) {
   45
 }
-p timeout(5, Timeout::Error) {
+p Timeout.timeout(5, Timeout::Error) {
   45
 }
-p timeout(nil) {
+p Timeout.timeout(nil) {
   54
 }
-p timeout(0) {
+p Timeout.timeout(0) {
   54
 }
 begin
-  timeout(5) {progress}
+  Timeout.timeout(5) {progress}
 rescue => e
   puts e.message
 end
 begin
-  timeout(3) {
+  Timeout.timeout(3) {
     begin
-      timeout(5) {progress}
+      Timeout.timeout(5) {progress}
     rescue => e
       puts "never reach"
     end
@@ -36,7 +36,7 @@ end https://github.com/ruby/ruby/blob/trunk/sample/timeout.rb#L36
 class MyTimeout < StandardError
 end
 begin
-  timeout(2, MyTimeout) {progress}
+  Timeout.timeout(2, MyTimeout) {progress}
 rescue MyTimeout => e
   puts e.message
 end

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

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