Class: Qti::V2::Models::AssessmentTest
Constant Summary
Constants inherited
from Base
Base::BODY_ELEMENTS_CSS, Base::CHOICE_ELEMENTS_CSS, Base::INTERACTION_ELEMENTS_CSS
Instance Attribute Summary
Attributes inherited from Models::Base
#doc, #manifest, #package_root, #path, #resource
Instance Method Summary
collapse
#rtype_predicate, #xpath_endswith, #xpath_resource
#canvas_meta_data
Methods inherited from Base
#qti_version
#css_with_single_check, from_path!, #initialize, #parse_html, #parse_xml, #preprocess_xml_doc, #raise_unsupported, #remap_href_path, #sanitize_content!, #xpath_with_single_check
Instance Method Details
#assessment_items ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/qti/v2/models/assessment_test.rb', line 12
def assessment_items
@assessment_items ||= begin
@doc.xpath('//xmlns:assessmentItemRef/@href').map(&:content).map do |href|
{ path: remap_href_path(href), resource: self }
end
end
end
|
#assessment_sections ⇒ Object
25
26
27
|
# File 'lib/qti/v2/models/assessment_test.rb', line 25
def assessment_sections
@assessment_sections ||= test_parts.first.xpath('//xmlns:assessmentSection')
end
|
#create_assessment_item(ref) ⇒ Object
29
30
31
32
33
|
# File 'lib/qti/v2/models/assessment_test.rb', line 29
def create_assessment_item(ref)
item = Qti::V2::Models::AssessmentItem.from_path!(ref[:path], @package_root, ref[:resource])
item.manifest = manifest
item
end
|
#create_stimulus(stimulus_ref) ⇒ Object
39
40
41
|
# File 'lib/qti/v2/models/assessment_test.rb', line 39
def create_stimulus(stimulus_ref)
Qti::V2::Models::StimulusItem.new(path: stimulus_ref, package_root: @package_root, html: true)
end
|
#stimulus_ref(_ref) ⇒ Object
35
36
37
|
# File 'lib/qti/v2/models/assessment_test.rb', line 35
def stimulus_ref(_ref)
nil
end
|
#test_parts ⇒ Object
21
22
23
|
# File 'lib/qti/v2/models/assessment_test.rb', line 21
def test_parts
@test_parts ||= @doc.xpath('//xmlns:testPart')
end
|
#title ⇒ Object
8
9
10
|
# File 'lib/qti/v2/models/assessment_test.rb', line 8
def title
@title ||= xpath_with_single_check('//xmlns:assessmentTest/@title')&.content || File.basename(@path, '.xml')
end
|