Class: RelatedPeople
- Inherits:
-
Object
- Object
- RelatedPeople
- Includes:
- Utilities
- Defined in:
- lib/related_people.rb
Instance Method Summary collapse
-
#get_related ⇒ Object
Get list of groups.
-
#initialize(html) ⇒ RelatedPeople
constructor
A new instance of RelatedPeople.
- #parse_related ⇒ Object
-
#related_link(person) ⇒ Object
Get link to related person’s profile.
-
#related_name(person) ⇒ Object
Get name of related person.
-
#related_person_company(person) ⇒ Object
Get related person’s company.
-
#related_person_title(person) ⇒ Object
Get title of related person.
Methods included from Utilities
Constructor Details
#initialize(html) ⇒ RelatedPeople
Returns a new instance of RelatedPeople.
6 7 8 9 |
# File 'lib/related_people.rb', line 6 def initialize(html) @html = html end |
Instance Method Details
#get_related ⇒ Object
Get list of groups
12 13 14 |
# File 'lib/related_people.rb', line 12 def return @related_people_list end |
#parse_related ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/related_people.rb', line 16 def = @html.css(".insights").css(".browse-map").css(".profile-card") @related_people_list = Array.new .each do |person| @related_people_list.push({ related_name: (person), related_link: (person), related_person_company: (person), related_person_title: (person) }) end end |
#related_link(person) ⇒ Object
Get link to related person’s profile
36 37 38 |
# File 'lib/related_people.rb', line 36 def (person) return person.css("h4").css("a")[0]["href"] end |
#related_name(person) ⇒ Object
Get name of related person
31 32 33 |
# File 'lib/related_people.rb', line 31 def (person) return person.css("h4").text end |
#related_person_company(person) ⇒ Object
Get related person’s company
41 42 43 |
# File 'lib/related_people.rb', line 41 def (person) return person.css(".headline").text.split(" at ")[1] end |
#related_person_title(person) ⇒ Object
Get title of related person
46 47 48 |
# File 'lib/related_people.rb', line 46 def (person) return person.css(".headline").text.split(" at ")[0] end |