Class: Governator::Panel

Inherits:
PageScraper show all
Defined in:
lib/governator/panel.rb

Instance Attribute Summary

Attributes inherited from PageScraper

#raw

Instance Method Summary collapse

Methods inherited from PageScraper

#initialize, #nbsp

Constructor Details

This class inherits a constructor from Governator::PageScraper

Instance Method Details

#bio_pageObject



11
12
13
# File 'lib/governator/panel.rb', line 11

def bio_page
  @_bio_page ||= raw.css('.governors-state a').first['href']
end

#governor_nameObject



15
16
17
18
19
20
21
# File 'lib/governator/panel.rb', line 15

def governor_name
  @_governor_name ||= raw.css('.governors-state a')
                         .first
                         .text
                         .sub('Governor ', '')
                         .gsub('  ', ' ')
end

#imageObject



7
8
9
# File 'lib/governator/panel.rb', line 7

def image
  @_image ||= raw.css('.governors-img img').first['src']
end

#stateObject



23
24
25
26
27
28
29
30
# File 'lib/governator/panel.rb', line 23

def state
  state = raw.css('.governors-state h3').first.text
  case state
  when 'Northern Mariana Islands' then 'Commonwealth of the ' + state
  when 'Virgin Islands' then 'United States ' + state
  else state
  end
end