Class: Qti::V1::Models::Choices::FillBlankChoice

Inherits:
Base show all
Defined in:
lib/qti/v1/models/choices/fill_blank_choice.rb

Instance Attribute Summary

Attributes inherited from Models::Base

#doc, #manifest, #package_root, #path, #resource

Instance Method Summary collapse

Methods inherited from Base

#qti_version, #return_inner_content!, #sanitize_attributes, #sanitize_attributes_by_node

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

Returns a new instance of FillBlankChoice.



6
7
8
9
# File 'lib/qti/v1/models/choices/fill_blank_choice.rb', line 6

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

Instance Method Details

#identifierObject



11
12
13
14
# File 'lib/qti/v1/models/choices/fill_blank_choice.rb', line 11

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

#item_bodyObject



24
25
26
27
28
29
30
# File 'lib/qti/v1/models/choices/fill_blank_choice.rb', line 24

def item_body
  @item_body ||= begin
    node = @node.dup
    inner_content = return_inner_content!(node)
    sanitize_content!(inner_content)
  end
end

#parent_identifierObject



16
17
18
# File 'lib/qti/v1/models/choices/fill_blank_choice.rb', line 16

def parent_identifier
  @parent_identifier ||= @node.parent.parent.attributes['ident']&.value
end

#positionObject



20
21
22
# File 'lib/qti/v1/models/choices/fill_blank_choice.rb', line 20

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