lib/linodians.rb in linodians-0.0.4 vs lib/linodians.rb in linodians-0.0.5

- old
+ new

@@ -12,17 +12,20 @@ # Insert a helper .new() method for creating a new Group object def new(*args) self::Group.new(*args) end + def load_data(data = nil) + (data || download_data).map { |x| Employee.new x } + end + + private + def download_data Nokogiri::HTML(open(DATA_URL)).css('.employee-display').map do |block| - data = parse_user(block).merge parse_social(block) - Employee.new data + parse_user(block).merge parse_social(block) end end - - private def parse_user(block) { username: block.at_css('img')['img-name'], fullname: block.at_css('strong').text,