aboutsummaryrefslogtreecommitdiffstats
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-26 12:45:43 +0000
commit171cd53005c439ab76f2e8ca41d13b9b329a800c (patch)
treeb5c09a0d74bc3663ac7e4acaaa3f7845e8c82f68
parentd29ab6b1ef7b005b3dbd2e0f1c295e2022794267 (diff)
Ruby 1.8 compatibility fixes.
-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