Skip to content

Instantly share code, notes, and snippets.

@gmcinnes
Created October 21, 2009 19:25
Show Gist options
  • Save gmcinnes/215378 to your computer and use it in GitHub Desktop.
Save gmcinnes/215378 to your computer and use it in GitHub Desktop.
f = File.open('sinatra.log', 'r')
hashes = []
str = ""
toggle = false
f.each_line do |line|
if line.match(/ \{.*/)
toggle = true
end
if toggle
unless line.match(/marktime/)
line = " }\n" if line.match(/ \}.*\x33/) || line.match(/ \}.*Open/)
str += line
end
end
if line.match(/ \}$/) || line.match(/ \}.*\x33/) || line.match(/ \}.*Open/)
str = str.gsub("{\\n", "{\n")
toggle = false
hash = eval(str)
hashes << hash
str = ""
end
end
ids = hashes.map do |hsh|
hsh['evaluation_id'] || hsh['adherence_check_id'] || nil
end
puts ids
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment