Class: Qti::V1::Models::StimulusItem
- Inherits:
-
Base
- Object
- Models::Base
- Base
- Qti::V1::Models::StimulusItem
- Defined in:
- lib/qti/v1/models/stimulus_item.rb
Instance Attribute Summary
Attributes inherited from Models::Base
#doc, #manifest, #package_root, #path, #resource
Instance Method Summary collapse
- #body ⇒ Object
- #identifier ⇒ Object
-
#initialize(ref_node) ⇒ StimulusItem
constructor
A new instance of StimulusItem.
- #stimulus_type ⇒ Object
- #title ⇒ Object
Methods inherited from Base
#qti_version, #return_inner_content!
Methods inherited from Models::Base
#css_with_single_check, from_path!, #parse_html, #parse_xml, #preprocess_xml_doc, #raise_unsupported, #remap_href_path, #sanitize_content!, #xpath_with_single_check
Constructor Details
#initialize(ref_node) ⇒ StimulusItem
Returns a new instance of StimulusItem.
5 6 7 |
# File 'lib/qti/v1/models/stimulus_item.rb', line 5 def initialize(ref_node) @node = ref_node end |
Instance Method Details
#body ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/qti/v1/models/stimulus_item.rb', line 17 def body @body ||= begin presentation = @node.at_xpath('.//xmlns:presentation') return nil if presentation.blank? sanitize_content!(presentation.at_xpath('.//xmlns:mattext')&.text) end end |
#identifier ⇒ Object
9 10 11 |
# File 'lib/qti/v1/models/stimulus_item.rb', line 9 def identifier @identifier ||= @node.attributes['ident']&.value end |
#stimulus_type ⇒ Object
25 26 27 |
# File 'lib/qti/v1/models/stimulus_item.rb', line 25 def stimulus_type 'text' end |
#title ⇒ Object
13 14 15 |
# File 'lib/qti/v1/models/stimulus_item.rb', line 13 def title @title ||= @node.attributes['title']&.value end |