Class: Qti::V2::Models::Choices::SimpleChoice
- Inherits:
-
Base
- Object
- Models::Base
- Base
- Qti::V2::Models::Choices::SimpleChoice
- Defined in:
- lib/qti/v2/models/choices/simple_choice.rb
Direct Known Subclasses
Constant Summary collapse
- PROHIBITED_NODE_NAMES =
%w[feedbackInline].join(',').freeze
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
- #identifier ⇒ Object
-
#initialize(node, parent) ⇒ SimpleChoice
constructor
A new instance of SimpleChoice.
- #item_body ⇒ Object
Methods inherited from Base
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(node, parent) ⇒ SimpleChoice
Returns a new instance of SimpleChoice.
8 9 10 11 |
# File 'lib/qti/v2/models/choices/simple_choice.rb', line 8 def initialize(node, parent) @node = node copy_paths_from_item(parent) end |
Instance Method Details
#identifier ⇒ Object
13 14 15 |
# File 'lib/qti/v2/models/choices/simple_choice.rb', line 13 def identifier @identifier ||= @node.attributes['identifier'].value end |
#item_body ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/qti/v2/models/choices/simple_choice.rb', line 17 def item_body @item_body ||= begin node = @node.dup node.children.filter(PROHIBITED_NODE_NAMES).map(&:unlink) sanitize_content!(node.to_html) end end |