Skip to content

Instantly share code, notes, and snippets.

@derwiki
Created January 18, 2012 18:25
Show Gist options
  • Save derwiki/1634659 to your computer and use it in GitHub Desktop.
Save derwiki/1634659 to your computer and use it in GitHub Desktop.
mainframe:~/causes[master %]$ cat perf.rb
#!/usr/bin/ruby
PASSENGER_LOG_REGEX = /(\w+)\s(\d+)\s(\d+).*Completed in (\d+\.\d+).*Rendering: (\d+\.\d+)/
File.open('jan-17-action-render-samples.log').each do |line|
PASSENGER_LOG_REGEX =~ line
puts {
:month => $1,
:day => $2,
:hour => $3,
:overall => $4,
:rendering => $5
}.inspect
end
mainframe:~/causes[master %]$ ./perf.rb
./perf.rb:7: syntax error
:month => $1,
^
./perf.rb:7: Can't set variable $1
./perf.rb:8: syntax error
:day => $2,
^
./perf.rb:8: Can't set variable $2
./perf.rb:9: syntax error
:hour => $3,
^
./perf.rb:9: Can't set variable $3
./perf.rb:10: syntax error
:overall => $4,
^
./perf.rb:10: Can't set variable $4
./perf.rb:11: syntax error
:rendering => $5
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment