Class: Senkyoshi::CourseToc

Inherits:
Object
  • Object
show all
Defined in:
lib/senkyoshi/models/course_toc.rb

Class Method Summary collapse

Class Method Details

.get_pre_data(xml, file_name) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/senkyoshi/models/course_toc.rb', line 21

def self.get_pre_data(xml, file_name)
  target_type = xml.xpath("/COURSETOC/TARGETTYPE/@value").first.text
  if target_type != "MODULE" || target_type != "DIVIDER"
    title = xml.xpath("/COURSETOC/LABEL/@value").first.text
    internal_handle = xml.xpath("/COURSETOC/INTERNALHANDLE/@value").
      first.text
    {
      title: title,
      target_type: target_type,
      original_file: file_name,
      internal_handle: internal_handle,
    }
  end
end