aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tasks/temp.rake
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-11-25 17:31:55 +0000
committerLouise Crow <louise.crow@gmail.com>2013-11-25 17:31:55 +0000
commit5ddd0620f8023c4bbf7d82e61f841dadd73bb7ba (patch)
treec5a6a2c7ff71624cb723a355121c1a793d0a7c46 /lib/tasks/temp.rake
parentd638509307854382ff981f188fb6d2cd584337ec (diff)
Ruby 1.8 compatibility fixes.
Diffstat (limited to 'lib/tasks/temp.rake')
-rw-r--r--lib/tasks/temp.rake6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/tasks/temp.rake b/lib/tasks/temp.rake
index bdee3027b..67fa10174 100644
--- a/lib/tasks/temp.rake
+++ b/lib/tasks/temp.rake
@@ -12,10 +12,10 @@ namespace :temp do
f = is_gz ? Zlib::GzipReader.open(log_file_path) : File.open(log_file_path, 'r')
processed = 0
f.each_line do |line|
- line.force_encoding('ASCII-8BIT')
- if request_match = line.match(/^Started (?<method>GET|OPTIONS|POST) "(?<path>\/request\/.*?)"/)
+ line.force_encoding('ASCII-8BIT') if RUBY_VERSION.to_f >= 1.9
+ if request_match = line.match(/^Started (GET|OPTIONS|POST) "(\/request\/.*?)"/)
next if line.match(/request\/\d+\/response/)
- urls[request_match[:path]] += 1
+ urls[request_match[2]] += 1
processed += 1
end
end