Class: Qti::V2::Models::StimulusItem
- Inherits:
-
Base
- Object
- Models::Base
- Base
- Qti::V2::Models::StimulusItem
- Defined in:
- lib/qti/v2/models/stimulus_item.rb
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
Methods inherited from Base
Methods inherited from Models::Base
#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
Constructor Details
This class inherits a constructor from Qti::Models::Base
Instance Method Details
#body ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/qti/v2/models/stimulus_item.rb', line 5 def body @body ||= begin item_body_node = xpath_with_single_check('//html/body') node = item_body_node.dup # Filter undesired interaction nodes out of the list (need to make this a deep traversal) node.children.filter(INTERACTION_ELEMENTS_CSS).map(&:unlink) sanitize_content!(node.to_html) end end |
#identifier ⇒ Object
Not used yet
17 18 19 |
# File 'lib/qti/v2/models/stimulus_item.rb', line 17 def identifier @identifier ||= File.basename(path, '.html') end |
#stimulus_type ⇒ Object
25 26 27 |
# File 'lib/qti/v2/models/stimulus_item.rb', line 25 def stimulus_type 'text' end |
#title ⇒ Object
21 22 23 |
# File 'lib/qti/v2/models/stimulus_item.rb', line 21 def title @title ||= xpath_with_single_check('//html/head/title')&.content end |