class OwaspRiScraper::EventParser

Public Instance Methods

parse(content) click to toggle source

This method is extremely fragile, but so far OWASP.org has been sticking to the same format, so that may be okay.

# File lib/owasp_ri_scraper/event_parser.rb, line 13
def parse(content)
  doc = Nokogiri::HTML.parse(content)
  event_node = doc.css('div#mw-content-text pre').first

  start_time = event_node.css('b').text
  description = event_node.children.select(&:text?).map(&:text).join("\n").strip

  Event.new(
    TIMEZONE.parse(start_time),
    nil,
    description
  )
end