Class: Groups
Instance Method Summary collapse
-
#get_groups ⇒ Object
Get list of groups.
-
#group_link(group) ⇒ Object
Get group link.
-
#group_name(group) ⇒ Object
Get group name.
-
#initialize(html) ⇒ Groups
constructor
A new instance of Groups.
- #parse_groups ⇒ Object
Methods included from Utilities
Constructor Details
#initialize(html) ⇒ Groups
Returns a new instance of Groups.
6 7 8 9 |
# File 'lib/groups.rb', line 6 def initialize(html) @html = html parse_groups end |
Instance Method Details
#get_groups ⇒ Object
Get list of groups
12 13 14 |
# File 'lib/groups.rb', line 12 def get_groups return @group_list end |
#group_link(group) ⇒ Object
Get group link
34 35 36 |
# File 'lib/groups.rb', line 34 def group_link(group) return group.css("a")[0]["href"] end |
#group_name(group) ⇒ Object
Get group name
29 30 31 |
# File 'lib/groups.rb', line 29 def group_name(group) return group.text end |
#parse_groups ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/groups.rb', line 16 def parse_groups groups = @html.css('#groups').css('.group').css('.item-title') @group_list = Array.new groups.each do |group| @group_list.push({ group_name: group_name(group), group_link: group_link(group) }) end end |