Class: Qti::Models::Manifest
- Inherits:
-
Base
- Object
- Base
- Qti::Models::Manifest
show all
- Defined in:
- lib/qti/models/manifest.rb
Constant Summary
Constants inherited
from Base
Base::ELEMENTS_REMAP
Instance Attribute Summary
Attributes inherited from Base
#doc, #manifest, #package_root, #path
Instance Method Summary
collapse
Methods inherited from 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
Instance Method Details
#assessment_test ⇒ Object
6
7
8
9
10
|
# File 'lib/qti/models/manifest.rb', line 6
def assessment_test
test = qti_2_x_href || qti_1_href || qti_2_non_assessment_href || unknown_type
test.manifest = self
test
end
|
#qti_1_href ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/qti/models/manifest.rb', line 12
def qti_1_href
test_path = xmlns_resource("[@type='imsqti_xmlv1p2']/@href") ||
xmlns_resource("[@type='imsqti_xmlv1p2']/xmlns:file/@href")
return unless test_path
Qti::V1::Models::Assessment.from_path!(
remap_href_path(test_path), @package_root
)
end
|
#qti_2_non_assessment_href ⇒ Object
30
31
32
33
34
|
# File 'lib/qti/models/manifest.rb', line 30
def qti_2_non_assessment_href
item_path = @doc.at_xpath("//xmlns:resources/xmlns:resource[@type='imsqti_item_xmlv2p1']/@href")&.content ||
@doc.at_xpath("//xmlns:resources/xmlns:resource[@type='imsqti_item_xmlv2p2']/@href")
Qti::V2::Models::NonAssessmentTest.from_path!(@path, @package_root) if item_path
end
|
#qti_2_x_href ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/qti/models/manifest.rb', line 21
def qti_2_x_href
test_path = xmlns_resource("[@type='imsqti_test_xmlv2p1']/@href") ||
xmlns_resource("[@type='imsqti_test_xmlv2p2']/@href")
return unless test_path
Qti::V2::Models::AssessmentTest.from_path!(
remap_href_path(test_path), @package_root
)
end
|
#unknown_type ⇒ Object
36
37
38
|
# File 'lib/qti/models/manifest.rb', line 36
def unknown_type
raise Qti::UnsupportedSchema, 'Unsupported QTI version'
end
|