Class: IndeedLinks
- Inherits:
-
Object
- Object
- IndeedLinks
- Includes:
- IndeedUtilities
- Defined in:
- lib/indeed_links.rb
Instance Method Summary collapse
-
#get_links ⇒ Object
Return person info.
-
#initialize(html) ⇒ IndeedLinks
constructor
A new instance of IndeedLinks.
-
#link_title(link) ⇒ Object
Get title of link.
-
#link_url(link) ⇒ Object
Get link url.
Methods included from IndeedUtilities
Constructor Details
#initialize(html) ⇒ IndeedLinks
Returns a new instance of IndeedLinks.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/indeed_links.rb', line 6 def initialize(html) links = html.xpath("//div[contains(concat(' ',normalize-space(@class),' '),' link-section ')]") @link_list = Array.new links.each do |link| @link_list.push({ link_title: link_title(link), link_url: link_url(link) }) end end |
Instance Method Details
#get_links ⇒ Object
Return person info
19 20 21 |
# File 'lib/indeed_links.rb', line 19 def get_links return @link_list end |
#link_title(link) ⇒ Object
Get title of link
24 25 26 |
# File 'lib/indeed_links.rb', line 24 def link_title(link) link.xpath(".//a").text end |
#link_url(link) ⇒ Object
Get link url
29 30 31 |
# File 'lib/indeed_links.rb', line 29 def link_url(link) link.xpath(".//a").first['href'] end |