gmcinnes (owner)

Revisions

gist: 215378 Download_button fork
public
Public Clone URL: git://gist.github.com/215378.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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