Class: IndeedGroups
- Inherits:
-
Object
- Object
- IndeedGroups
- Includes:
- IndeedUtilities
- Defined in:
- lib/indeed_groups.rb
Instance Method Summary collapse
-
#get_groups ⇒ Object
Return group info.
-
#group_description(group) ⇒ Object
Get description of group.
-
#group_end_date(group) ⇒ Object
Get group end date.
-
#group_start_date(group) ⇒ Object
Get start date for group.
-
#group_title(group) ⇒ Object
Get title of group.
-
#initialize(html) ⇒ IndeedGroups
constructor
A new instance of IndeedGroups.
Methods included from IndeedUtilities
Constructor Details
#initialize(html) ⇒ IndeedGroups
Returns a new instance of IndeedGroups.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/indeed_groups.rb', line 6 def initialize(html) groups = html.xpath("//div[contains(concat(' ',normalize-space(@class),' '),' group-section ')]") @group_list = Array.new groups.each do |group| @group_list.push({ group_title: group_title(group), group_description: group_description(group), group_start_date: group_start_date(group), group_end_date: group_end_date(group) }) end end |
Instance Method Details
#get_groups ⇒ Object
Return group info
21 22 23 |
# File 'lib/indeed_groups.rb', line 21 def get_groups return @group_list end |
#group_description(group) ⇒ Object
Get description of group
31 32 33 |
# File 'lib/indeed_groups.rb', line 31 def group_description(group) group.xpath(".//p[@class='group_description']").text end |
#group_end_date(group) ⇒ Object
Get group end date
41 42 43 |
# File 'lib/indeed_groups.rb', line 41 def group_end_date(group) parse_dates(group.xpath(".//p[@class='group_date']").text)[1] end |
#group_start_date(group) ⇒ Object
Get start date for group
36 37 38 |
# File 'lib/indeed_groups.rb', line 36 def group_start_date(group) parse_dates(group.xpath(".//p[@class='group_date']").text)[0] end |
#group_title(group) ⇒ Object
Get title of group
26 27 28 |
# File 'lib/indeed_groups.rb', line 26 def group_title(group) group.xpath(".//p[@class='group_title']").text end |