Module: Adam::KillLog

Extended by:
KillLog
Included in:
KillLog
Defined in:
lib/adam/kill_log.rb,
lib/adam/kill_log/validation_error.rb

Defined Under Namespace

Classes: ValidationError

Instance Method Summary collapse

Instance Method Details

#parse(source) ⇒ Object

Parses a kill log and returns an array of Kill objects.

Parameters:

  • source - A kill log as returned by the EVE Online API.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/adam/kill_log.rb', line 20

def parse(source)
  document = Hpricot.XML(source)

  kill_logs = []
  document.search("//rowset[@name=kills]/row").each do |kill_log|
    begin
      kill_logs << parse_single(kill_log)
    rescue ValidationError
      next
    end
  end

  kill_logs
end