Class: Moodle2CC::CanvasCC::QuestionWriter
- Inherits:
-
Object
- Object
- Moodle2CC::CanvasCC::QuestionWriter
show all
- Defined in:
- lib/moodle2cc/canvas_cc/question_writer.rb
Direct Known Subclasses
CalculatedQuestionWriter, EssayQuestionWriter, MatchingQuestionWriter, MultipleAnswersQuestionWriter, MultipleBlanksQuestionWriter, MultipleChoiceQuestionWriter, MultipleDropdownsQuestionWriter, NumericalQuestionWriter, ShortAnswerQuestionWriter, TextOnlyQuestionWriter, TrueFalseQuestionWriter
Constant Summary
collapse
- @@subclasses =
{}
Class Method Summary
collapse
Class Method Details
.register_writer_type(name) ⇒ Object
14
15
16
|
# File 'lib/moodle2cc/canvas_cc/question_writer.rb', line 14
def self.register_writer_type(name)
@@subclasses[name] = self
end
|
.write_question(node, question) ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/moodle2cc/canvas_cc/question_writer.rb', line 6
def self.write_question(node, question)
if c = @@subclasses[question.question_type]
c.write_question_item_xml(node, question)
else
raise "Unknown question writer type: #{question.question_type}"
end
end
|
.write_question_item_xml(node, question) ⇒ Object
18
19
20
21
22
23
24
25
26
|
# File 'lib/moodle2cc/canvas_cc/question_writer.rb', line 18
def self.write_question_item_xml(node, question)
node.item(:title => question.title, :ident => question.identifier) do |item_node|
write_qti_metadata(item_node, question)
write_presentation(item_node, question)
write_resprocessing(item_node, question)
write_general_feedback(item_node, question)
write_additional_nodes(item_node, question)
end
end
|