Class: Qti::V2::Models::Choices::GapMatchChoice

Inherits:
Base show all
Defined in:
lib/qti/v2/models/choices/gap_match_choice.rb

Constant Summary collapse

PROHIBITED_NODE_NAMES =
'feedbackInline'.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

Methods inherited from Base

#qti_version

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) ⇒ GapMatchChoice

Returns a new instance of GapMatchChoice.



7
8
9
10
# File 'lib/qti/v2/models/choices/gap_match_choice.rb', line 7

def initialize(node, parent)
  @node = node
  copy_paths_from_item(parent)
end

Instance Method Details

#identifierObject



12
13
14
# File 'lib/qti/v2/models/choices/gap_match_choice.rb', line 12

def identifier
  @identifier ||= @node.attributes['identifier'].value
end

#item_bodyObject



16
17
18
19
20
21
22
# File 'lib/qti/v2/models/choices/gap_match_choice.rb', line 16

def item_body
  @item_body ||= begin
    node = @node.dup
    node.children.filter(PROHIBITED_NODE_NAMES).each(&:unlink)
    sanitize_content!(node.to_html)
  end
end