class Moodle2CC::Moodle2Converter::QuestionConverters::MatchingConverter

Public Instance Methods

convert_question(moodle_question) click to toggle source
Calls superclass method
# File lib/moodle2cc/moodle2converter/question_converters/matching_converter.rb, line 7
def convert_question(moodle_question)
  canvas_question = super
  canvas_question.matches = []

  moodle_question.matches.each do |match|
    copy = match.dup
    copy[:question_text] ||= ''
    copy[:question_text].gsub(/\{(.*?)\}/, '[\1]')
    if copy[:question_text_format].to_i == 4 # markdown
      copy[:question_text] = RDiscount.new(copy[:question_text]).to_html
      copy[:question_text_format] = '1' # html
    end
    canvas_question.matches << copy
  end
  canvas_question
end