module Mwcrawler::Departments
Scraps Departments
by campus
Public Class Methods
scrap(campus)
click to toggle source
# File lib/mwcrawler/departments.rb, line 6 def self.scrap(campus) page = Helpers.set_crawler(campus, 'graduacao/oferta_dep.aspx?cod=') departments = page.css('#datatable tr td').map(&:text) # CADA DEPARTAMENTO SERA UMA LINHA, ENTAO rows E O CONJUNTO DE TODOS OS DEPARTAMENTOS rows = [] rows << scrap_row(departments) until departments.empty? rows end
Private Class Methods
scrap_row(departments)
click to toggle source
# File lib/mwcrawler/departments.rb, line 18 def self.scrap_row(departments) row = {} row['code'] = departments.shift row['acronym'] = departments.shift row['name'] = departments.shift row end