From 6160e4b9f4be0835a59874863de79b066fde1b2c Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 26 Oct 2015 14:51:39 +0000 Subject: [PATCH] logger.rb: exact matching * lib/logger.rb ({next,previous}_rotate_time): dispatch by exact matching shift_age instead of regexp matching. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/logger.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/logger.rb b/lib/logger.rb index 14dd71cd62..bb4953e437 100644 --- a/lib/logger.rb +++ b/lib/logger.rb @@ -533,11 +533,11 @@ private def next_rotate_time(now, shift_age) case shift_age - when /^daily$/ + when 'daily' t = Time.mktime(now.year, now.month, now.mday) + SiD - when /^weekly$/ + when 'weekly' t = Time.mktime(now.year, now.month, now.mday) + SiD * (7 - now.wday) - when /^monthly$/ + when 'monthly' t = Time.mktime(now.year, now.month, 1) + SiD * 31 mday = (1 if t.mday > 1) else @@ -551,11 +551,11 @@ private def previous_period_end(now, shift_age) case shift_age - when /^daily$/ + when 'daily' t = Time.mktime(now.year, now.month, now.mday) - SiD / 2 - when /^weekly$/ + when 'weekly' t = Time.mktime(now.year, now.month, now.mday) - (SiD * (now.wday + 1) + SiD / 2) - when /^monthly$/ + when 'monthly' t = Time.mktime(now.year, now.month, 1) - SiD / 2 else return now