Class: Qti::V1::Models::Assessment
Constant Summary
collapse
- GROUP_ID =
'xmlns:section/xmlns:selection_ordering'.freeze
Instance Attribute Summary
Attributes inherited from Models::Base
#doc, #manifest, #package_root, #path, #resource
Instance Method Summary
collapse
#canvas_meta_data
Methods inherited from Base
#qti_version, #return_inner_content!, #sanitize_attributes, #sanitize_attributes_by_node
#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
21
22
23
24
|
# File 'lib/qti/v1/models/assessment.rb', line 21
def assessment_items
@doc.xpath("//*[self::#{GROUP_ID} or self::xmlns:item[not(ancestor::#{GROUP_ID})]" \
' or self::xmlns:bankentry_item]')
end
|
#create_assessment_item(assessment_item) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/qti/v1/models/assessment.rb', line 26
def create_assessment_item(assessment_item)
return nil if sub_section?(assessment_item) || bank_entry_item?(assessment_item)
item = Qti::V1::Models::AssessmentItem.new(assessment_item, @package_root, self)
item.manifest = manifest
item
end
|
#create_bank_entry_item(bank_entry_item_ref) ⇒ Object
47
48
49
50
|
# File 'lib/qti/v1/models/assessment.rb', line 47
def create_bank_entry_item(bank_entry_item_ref)
return nil unless bank_entry_item?(bank_entry_item_ref)
Qti::V1::Models::BankEntryItem.new(bank_entry_item_ref)
end
|
#create_question_group(group_ref) ⇒ Object
42
43
44
45
|
# File 'lib/qti/v1/models/assessment.rb', line 42
def create_question_group(group_ref)
return nil unless question_group?(group_ref)
Qti::V1::Models::QuestionGroup.new(group_ref)
end
|
#create_stimulus(stimulus_ref) ⇒ Object
37
38
39
40
|
# File 'lib/qti/v1/models/assessment.rb', line 37
def create_stimulus(stimulus_ref)
return nil unless stimulus?(stimulus_ref)
Qti::V1::Models::StimulusItem.new(stimulus_ref)
end
|
#external_assignment_id ⇒ Object
17
18
19
|
# File 'lib/qti/v1/models/assessment.rb', line 17
def external_assignment_id
@external_assignment_id ||= xpath_with_single_check('.//xmlns:assessment/@external_assignment_id')&.content
end
|
#identifier ⇒ Object
9
10
11
|
# File 'lib/qti/v1/models/assessment.rb', line 9
def identifier
@identifier ||= xpath_with_single_check('.//xmlns:assessment/@ident')&.content
end
|
#stimulus_ref(assessment_item_ref) ⇒ Object
33
34
35
|
# File 'lib/qti/v1/models/assessment.rb', line 33
def stimulus_ref(assessment_item_ref)
assessment_item_ref
end
|
#title ⇒ Object
13
14
15
|
# File 'lib/qti/v1/models/assessment.rb', line 13
def title
@title ||= xpath_with_single_check('.//xmlns:assessment/@title')&.content || File.basename(@path, '.xml')
end
|