Class: Moodle2CC::CanvasCC::Models::CalculatedQuestion

Inherits:
Question
  • Object
show all
Defined in:
lib/moodle2cc/canvas_cc/models/calculated_question.rb

Constant Summary

Constants inherited from Question

Question::QTI_META_ATTRIBUTES, Question::STANDARD_QUESTION_TYPES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Question

create, #initialize, register_question_type

Constructor Details

This class inherits a constructor from Moodle2CC::CanvasCC::Models::Question

Instance Attribute Details

#correct_answer_formatObject

Returns the value of attribute correct_answer_format.



5
6
7
# File 'lib/moodle2cc/canvas_cc/models/calculated_question.rb', line 5

def correct_answer_format
  @correct_answer_format
end

#correct_answer_lengthObject

Returns the value of attribute correct_answer_length.



5
6
7
# File 'lib/moodle2cc/canvas_cc/models/calculated_question.rb', line 5

def correct_answer_length
  @correct_answer_length
end

#dataset_definitionsObject

Returns the value of attribute dataset_definitions.



5
6
7
# File 'lib/moodle2cc/canvas_cc/models/calculated_question.rb', line 5

def dataset_definitions
  @dataset_definitions
end

#toleranceObject

Returns the value of attribute tolerance.



5
6
7
# File 'lib/moodle2cc/canvas_cc/models/calculated_question.rb', line 5

def tolerance
  @tolerance
end

#var_setsObject

Returns the value of attribute var_sets.



5
6
7
# File 'lib/moodle2cc/canvas_cc/models/calculated_question.rb', line 5

def var_sets
  @var_sets
end

Instance Method Details

#post_process!Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/moodle2cc/canvas_cc/models/calculated_question.rb', line 7

def post_process!
  @material.gsub!(/\{([\w\s]*?)\}/, '[\1]') if @material

  return unless @answers
  @answers.each do |answer|
    if answer.answer_text
      answer.answer_text.gsub!(/\{([\w\s]*?)\}/, '\1')
      answer.answer_text = answer.answer_text.sub('=', '') if answer.answer_text.start_with?('=')
    end
  end
end