ruby-changes:23329
From: nobu <ko1@a...>
Date: Wed, 18 Apr 2012 10:58:59 +0900 (JST)
Subject: [ruby-changes:23329] nobu:r35380 (trunk): split method definitions
nobu 2012-04-18 10:58:49 +0900 (Wed, 18 Apr 2012) New Revision: 35380 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35380 Log: split method definitions * test/ruby/test_time_tz.rb (TestTimeTZ#with_tz, TestTimeTZ#time_to_s): split method definitions. Modified files: trunk/test/ruby/test_time_tz.rb Index: test/ruby/test_time_tz.rb =================================================================== --- test/ruby/test_time_tz.rb (revision 35379) +++ test/ruby/test_time_tz.rb (revision 35380) @@ -1,8 +1,9 @@ require 'test/unit' class TestTimeTZ < Test::Unit::TestCase - def with_tz(tz) - if /linux/ =~ RUBY_PLATFORM || ENV["RUBY_FORCE_TIME_TZ_TEST"] == "yes" + force_tz_test = /linux/ =~ RUBY_PLATFORM || ENV["RUBY_FORCE_TIME_TZ_TEST"] == "yes" + if force_tz_test + def with_tz(tz) old = ENV["TZ"] begin ENV["TZ"] = tz @@ -10,7 +11,9 @@ ensure ENV["TZ"] = old end - else + end + else + def with_tz(tz) if ENV["TZ"] == tz yield end @@ -60,10 +63,12 @@ include Util extend Util - def time_to_s(t) - if RUBY_VERSION < "1.9" + if RUBY_VERSION < "1.9" + def time_to_s(t) t.strftime("%Y-%m-%d %H:%M:%S ") + format_gmtoff(t.gmtoff) - else + end + else + def time_to_s(t) t.to_s end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/