class Qti::V2::Models::Interactions::MatchInteraction

Attributes

implementation[R]

Public Class Methods

matches(node, parent) click to toggle source
# File lib/qti/v2/models/interactions/match_interaction.rb, line 24
def self.matches(node, parent)
  implementation =
    if use_associate_interaction_implementation?(node)
      MatchItemTagProcessors::AssociateInteractionTagProcessor
    elsif use_match_interaction_implementation?(node)
      MatchItemTagProcessors::MatchInteractionTagProcessor
    end

  return false unless implementation.present?
  new(node, parent, implementation)
end
new(node, parent, implementation) click to toggle source
# File lib/qti/v2/models/interactions/match_interaction.rb, line 13
def initialize(node, parent, implementation)
  super(node, parent)
  @implementation = implementation.new(node, parent)
end
use_associate_interaction_implementation?(node) click to toggle source
# File lib/qti/v2/models/interactions/match_interaction.rb, line 36
def self.use_associate_interaction_implementation?(node)
  MatchItemTagProcessors::AssociateInteractionTagProcessor.associate_interaction_tag?(node) &&
    MatchItemTagProcessors::AssociateInteractionTagProcessor.number_of_questions_per_answer(node)
                                                            .all? { |n| n == 1 }
end
use_match_interaction_implementation?(node) click to toggle source
# File lib/qti/v2/models/interactions/match_interaction.rb, line 42
def self.use_match_interaction_implementation?(node)
  MatchItemTagProcessors::MatchInteractionTagProcessor.match_interaction_tag?(node) &&
    MatchItemTagProcessors::MatchInteractionTagProcessor.number_of_questions_per_answer(node)
                                                        .all? { |n| n == 1 }
end

Public Instance Methods

scoring_data_structs() click to toggle source
# File lib/qti/v2/models/interactions/match_interaction.rb, line 20
def scoring_data_structs
  implementation.scoring_data_structs
end