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

Inherits:
Base show all
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 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, #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



11
12
13
# File 'lib/qti/v1/models/assessment.rb', line 11

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

#create_assessment_item(assessment_item) ⇒ Object



15
16
17
18
19
# File 'lib/qti/v1/models/assessment.rb', line 15

def create_assessment_item(assessment_item)
  item = Qti::V1::Models::AssessmentItem.new(assessment_item, @package_root)
  item.manifest = manifest
  item
end

#create_stimulus(_stimulus) ⇒ Object



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

def create_stimulus(_stimulus)
  raise 'Stimulus type not supported for QTI version'
end

#stimulus_ref(_ref) ⇒ Object



21
22
23
# File 'lib/qti/v1/models/assessment.rb', line 21

def stimulus_ref(_ref)
  nil
end

#titleObject



7
8
9
# File 'lib/qti/v1/models/assessment.rb', line 7

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