Class: Moodle2CC::Moodle2::Parsers::QuestionCategoryParser
- Inherits:
-
Object
- Object
- Moodle2CC::Moodle2::Parsers::QuestionCategoryParser
- Includes:
- ParserHelper
- Defined in:
- lib/moodle2cc/moodle2/parsers/question_category_parser.rb
Constant Summary collapse
- QUESTIONS_XML =
'questions.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
-
#initialize(backup_dir) ⇒ QuestionCategoryParser
constructor
A new instance of QuestionCategoryParser.
- #parse ⇒ Object
Methods included from ParserHelper
#activity_directories, #parse_boolean, #parse_module, #parse_text
Constructor Details
#initialize(backup_dir) ⇒ QuestionCategoryParser
Returns a new instance of QuestionCategoryParser.
7 8 9 |
# File 'lib/moodle2cc/moodle2/parsers/question_category_parser.rb', line 7 def initialize(backup_dir) @backup_dir = backup_dir end |
Instance Method Details
#parse ⇒ Object
11 12 13 14 15 16 |
# File 'lib/moodle2cc/moodle2/parsers/question_category_parser.rb', line 11 def parse File.open(File.join(@backup_dir, QUESTIONS_XML)) do |f| root_xml = Nokogiri::XML(f) root_xml.search('/question_categories/question_category').map { |node| question_category_parser(node) } end end |