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

ruby-changes:33615

From: naruse <ko1@a...>
Date: Thu, 24 Apr 2014 10:01:23 +0900 (JST)
Subject: [ruby-changes:33615] naruse:r45696 (trunk): call to_i

naruse	2014-04-24 10:01:18 +0900 (Thu, 24 Apr 2014)

  New Revision: 45696

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

  Log:
    call to_i

  Modified files:
    trunk/test/ruby/test_io.rb
    trunk/test/ruby/test_sleep.rb
Index: test/ruby/test_io.rb
===================================================================
--- test/ruby/test_io.rb	(revision 45695)
+++ test/ruby/test_io.rb	(revision 45696)
@@ -1673,14 +1673,14 @@ class TestIO < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L1673
       when 0x9123683E # BTRFS_SUPER_MAGIC
       when 0x7461636f # OCFS2_SUPER_MAGIC
       when 0xEF53 # EXT2_SUPER_MAGIC EXT3_SUPER_MAGIC EXT4_SUPER_MAGIC
-        return false if (`/bin/uname -r`.split('.') <=> %w[3 8]) < 0
+        return false if (`/bin/uname -r`.split('.').map(&:to_i) <=> [3,8]) < 0
         # ext3's timestamp resolution is seconds
         s = f.stat
         s.mtime.nsec != 0 || s.atime.nsec != 0 || s.ctime.nsec != 0
       when 0x58465342 # XFS_SUPER_MAGIC
-        return false if (`/bin/uname -r`.split('.') <=> %w[3 5]) < 0
+        return false if (`/bin/uname -r`.split('.').map(&:to_i) <=> [3,5]) < 0
       when 0x01021994 # TMPFS_MAGIC
-        return false if (`/bin/uname -r`.split('.') <=> %w[3 8]) < 0
+        return false if (`/bin/uname -r`.split('.').map(&:to_i) <=> [3,8]) < 0
       else
         return false
       end
Index: test/ruby/test_sleep.rb
===================================================================
--- test/ruby/test_sleep.rb	(revision 45695)
+++ test/ruby/test_sleep.rb	(revision 45696)
@@ -9,7 +9,7 @@ class TestSleep < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_sleep.rb#L9
     bottom =
       case RUBY_PLATFORM
       when /linux/
-        4.98 if /Linux ([\d.]+)/ =~ `uname -sr` && ($1.split('.')<=>%w/2 6 18/)<1
+        4.98 if /Linux ([\d.]+)/ =~ `uname -sr` && ($1.split('.').map(&:to_i)<=>[2,6,18])<1
       when /mswin|mingw/
         4.98
       end

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

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