class Qti::V2::Models::StimulusItem

Public Instance Methods

body() click to toggle source
# 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() click to toggle source

Not used yet

# File lib/qti/v2/models/stimulus_item.rb, line 17
def identifier
  @identifier ||= File.basename(path, '.html')
end
stimulus_type() click to toggle source
# File lib/qti/v2/models/stimulus_item.rb, line 25
def stimulus_type
  'text'
end
title() click to toggle source
# File lib/qti/v2/models/stimulus_item.rb, line 21
def title
  @title ||= xpath_with_single_check('//html/head/title')&.content
end