Class: Qti::V1::Models::Assessment

Inherits:
Base show all
Includes:
Models::AssessmentMetaBase
Defined in:
lib/qti/v1/models/assessment.rb

Constant Summary

Constants inherited from Models::Base

Models::Base::ELEMENTS_REMAP

Instance Attribute Summary

Attributes inherited from Models::Base

#doc, #manifest, #package_root, #path

Instance Method Summary collapse

Methods included from Models::AssessmentMetaBase

#canvas_meta_data

Methods inherited from Base

#qti_version, #return_inner_content!

Methods inherited from Models::Base

#css_with_single_check, from_path!, #initialize, #object_tag_transformer, #parse_html, #parse_xml, #preprocess_xml_doc, #remap_href_path, #remap_unknown_tags_transformer, #sanitize_config, #sanitize_content!, #xpath_with_single_check

Constructor Details

This class inherits a constructor from Qti::Models::Base

Instance Method Details

#assessment_itemsObject



13
14
15
# File 'lib/qti/v1/models/assessment.rb', line 13

def assessment_items
  @doc.xpath('.//xmlns:item')
end

#create_assessment_item(assessment_item) ⇒ Object



17
18
19
20
21
22
# File 'lib/qti/v1/models/assessment.rb', line 17

def create_assessment_item(assessment_item)
  return nil if stimulus?(assessment_item)
  item = Qti::V1::Models::AssessmentItem.new(assessment_item, @package_root)
  item.manifest = manifest
  item
end

#create_stimulus(stimulus_ref) ⇒ Object



28
29
30
31
# File 'lib/qti/v1/models/assessment.rb', line 28

def create_stimulus(stimulus_ref)
  return nil unless stimulus?(stimulus_ref)
  Qti::V1::Models::StimulusItem.new(stimulus_ref)
end

#stimulus_ref(assessment_item_ref) ⇒ Object



24
25
26
# File 'lib/qti/v1/models/assessment.rb', line 24

def stimulus_ref(assessment_item_ref)
  assessment_item_ref
end

#titleObject



9
10
11
# File 'lib/qti/v1/models/assessment.rb', line 9

def title
  @title ||= xpath_with_single_check('.//xmlns:assessment/@title')&.content || File.basename(@path, '.xml')
end