28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/tableau/moduleparser.rb', line 28
def parse
raise "No module timetable loaded!" unless @raw_timetable
raw_info = @raw_timetable.xpath(@@COURSE_DESCRIPTION_XPATH).to_html
module_id = @@MODULE_ID_REGEX.match(raw_info).to_s
module_name = raw_info.gsub(module_id, '')
mod = Tableau::Module.new(module_id, name: module_name)
table_count = 1
table_data = @raw_timetable.xpath(xpath_for_table(table_count))
while !table_data.empty?
tables_classes = parse_table(table_data)
tables_classes.each { |c| mod.classes << c }
table_data = @raw_timetable.xpath(xpath_for_table(table_count += 1))
end
mod end
|