Class: SoutheasternDailyPerformance::AffectedServicesReport

Inherits:
Object
  • Object
show all
Defined in:
lib/southeastern_daily_performance/affected_services_report.rb

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ AffectedServicesReport

Returns a new instance of AffectedServicesReport.



6
7
8
9
# File 'lib/southeastern_daily_performance/affected_services_report.rb', line 6

def initialize(html)
  html.gsub!(/ /, ' ')
  @doc = Hpricot(html)
end

Instance Method Details

#affected_servicesObject



11
12
13
14
15
16
17
18
# File 'lib/southeastern_daily_performance/affected_services_report.rb', line 11

def affected_services
  @doc.search('*').collect do |elem|
    if elem.text? and incident_text = elem.inner_text[/\d\d:\d\d.*/]
      reason = find_previous_strong_element(elem).inner_text
      AffectedService.new(reason.strip, incident_text.strip)
    end
  end.compact
end