Method: Conflict::RequestParser#parse

Defined in:
lib/conflict/parsers.rb

#parse(diff, info, client) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/conflict/parsers.rb', line 28

def parse diff, info, client
  
  events = []

  for i in 0..diff.list.size - 1
      
    diff_data = diff.list[i].to_s.strip
    info_data = info.list[i].to_s.strip
      
    raise "no value for info @ index " + i.to_s if info_data.nil? or info_data.empty?
    
    lambda {
      infos = InfoParser::new().parse(info_data)
      events = events | DiffParser::new(infos.merge({:ttl=>@ttl})).parse(diff_data, client, infos[:url], infos[:path])
    }.call if ! diff_data.nil? && ! diff_data.empty?
    
  end
  
  events
  
end