class Qti::V2::Models::Interactions::BaseInteraction
Attributes
node[R]
Public Class Methods
matches(_node)
click to toggle source
# File lib/qti/v2/models/interactions/base_interaction.rb, line 8 def self.matches(_node) false end
new(node, parent)
click to toggle source
# File lib/qti/v2/models/interactions/base_interaction.rb, line 12 def initialize(node, parent) @node = node copy_paths_from_item(parent) end
Public Instance Methods
canvas_item_feedback()
click to toggle source
# File lib/qti/v2/models/interactions/base_interaction.rb, line 29 def canvas_item_feedback; end
scoring_data_structs()
click to toggle source
# File lib/qti/v2/models/interactions/base_interaction.rb, line 21 def scoring_data_structs @scoring_data_structs ||= begin type = xpath_with_single_check('//xmlns:responseDeclaration/@baseType').content value_nodes = node.xpath('//xmlns:responseDeclaration/xmlns:correctResponse/xmlns:value') value_nodes.map { |value_node| Models::ScoringData.new(value_node.content, type) } end end
shuffled?()
click to toggle source
# File lib/qti/v2/models/interactions/base_interaction.rb, line 17 def shuffled? @node.attributes['shuffle']&.value.try(:downcase) == 'true' end
xpath_with_single_check(xpath)
click to toggle source
# File lib/qti/v2/models/interactions/base_interaction.rb, line 31 def xpath_with_single_check(xpath) node_list = node.xpath(xpath) raise Qti::ParseError, 'Too many matches' if node_list.count > 1 node_list.first end