Class: Qti::V1::Models::AssessmentItem
- Inherits:
-
Base
show all
- Defined in:
- lib/qti/v1/models/assessment_item.rb
Constant Summary
Constants inherited
from Models::Base
Models::Base::ELEMENTS_REMAP
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
#qti_version
#css_with_single_check, from_path!, #parse_xml, #remap_href_path, #remap_unknown_tags_transformer, #sanitize_config, #sanitize_content!, #xpath_with_single_check
Constructor Details
Returns a new instance of AssessmentItem.
10
11
12
|
# File 'lib/qti/v1/models/assessment_item.rb', line 10
def initialize(item)
@doc = item
end
|
Instance Attribute Details
#doc ⇒ Object
Returns the value of attribute doc.
8
9
10
|
# File 'lib/qti/v1/models/assessment_item.rb', line 8
def doc
@doc
end
|
Instance Method Details
#identifier ⇒ Object
23
24
25
|
# File 'lib/qti/v1/models/assessment_item.rb', line 23
def identifier
@identifier ||= @doc.attribute('ident').value
end
|
#interaction_model ⇒ Object
#item_body ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'lib/qti/v1/models/assessment_item.rb', line 14
def item_body
@item_body ||= begin
node = @doc.dup
presentation = node.at_xpath('.//xmlns:presentation')
prompt = presentation.at_xpath('.//xmlns:mattext').content
sanitize_content!(prompt)
end
end
|
#points_possible ⇒ Object
31
32
33
34
35
|
# File 'lib/qti/v1/models/assessment_item.rb', line 31
def points_possible
@points_possible ||= begin
@doc.at_xpath('.//xmlns:decvar/@maxvalue')&.value || @doc.at_xpath('.//xmlns:decvar/@defaultval')&.value
end
end
|
#rcardinality ⇒ Object
37
38
39
|
# File 'lib/qti/v1/models/assessment_item.rb', line 37
def rcardinality
@rcardinality ||= @doc.at_xpath('.//xmlns:response_lid/@rcardinality').value
end
|
#scoring_data_structs ⇒ Object
47
48
49
|
# File 'lib/qti/v1/models/assessment_item.rb', line 47
def scoring_data_structs
@scoring_data_structs ||= interaction_model.scoring_data_structs
end
|
#title ⇒ Object
27
28
29
|
# File 'lib/qti/v1/models/assessment_item.rb', line 27
def title
@title ||= @doc.attribute('title').value
end
|