lib/linodians.rb in linodians-1.0.1 vs lib/linodians.rb in linodians-1.1.0

- old
+ new

@@ -20,17 +20,25 @@ end private def download_data - Nokogiri::HTML(open(DATA_URL)).css('.employee-display').map do |block| - parse_user(block).merge parse_social(block) + raw_data.map do |username, block| + parse_user(username, block).merge parse_social(block) end end - def parse_user(block) + def raw_data + Nokogiri::HTML(open(DATA_URL)).css('div').map do |block| + internal_block = block.at_xpath('div/div[@class="employee-display"]') + next unless internal_block + [block[:id], internal_block] + end.compact + end + + def parse_user(username, block) { - username: block.at_css('img')['img-name'], + username: username, fullname: block.at_css('strong').text, title: block.at_css('small').text } end