Class: Moodle2CC::Moodle2::Parsers::AssignmentParser

Inherits:
Object
  • Object
show all
Includes:
ParserHelper
Defined in:
lib/moodle2cc/moodle2/parsers/assignment_parser.rb

Constant Summary collapse

ASSIGNMENT_MODULE_NAMES =
{
  'assign' => 'assign.xml',
  'assignment' => 'assignment.xml'
}

Constants included from ParserHelper

ParserHelper::FILES_XML, ParserHelper::IMS_FILEBASE_TOKEN, ParserHelper::MODULE_XML, ParserHelper::MOODLE_FILEBASE_TOKEN, ParserHelper::SLASH_TOKEN, ParserHelper::XML_NULL_VALUE

Instance Method Summary collapse

Methods included from ParserHelper

#activity_directories, #parse_boolean, #parse_module, #parse_text

Constructor Details

#initialize(backup_dir) ⇒ AssignmentParser

Returns a new instance of AssignmentParser.



10
11
12
# File 'lib/moodle2cc/moodle2/parsers/assignment_parser.rb', line 10

def initialize(backup_dir)
  @backup_dir = backup_dir
end

Instance Method Details

#parseObject



14
15
16
17
18
19
20
21
# File 'lib/moodle2cc/moodle2/parsers/assignment_parser.rb', line 14

def parse
  assignments = []
  ASSIGNMENT_MODULE_NAMES.each do |mod_name, xml_file|
    activity_dirs = activity_directories(@backup_dir, mod_name)
    assignments += activity_dirs.map { |dir| parse_assignment(dir, mod_name, xml_file) }
  end
  assignments
end