Module: Qti::V2::Models::Interactions

Defined in:
lib/qti/v2/models/interactions.rb,
lib/qti/v2/models/interactions/base_interaction.rb,
lib/qti/v2/models/interactions/match_interaction.rb,
lib/qti/v2/models/interactions/choice_interaction.rb,
lib/qti/v2/models/interactions/ordering_interaction.rb,
lib/qti/v2/models/interactions/gap_match_interaction.rb,
lib/qti/v2/models/interactions/short_text_interaction.rb,
lib/qti/v2/models/interactions/extended_text_interaction.rb,
lib/qti/v2/models/interactions/categorization_interaction.rb,
lib/qti/v2/models/interactions/match_item_tag_processors/match_interaction_tag_processor.rb,
lib/qti/v2/models/interactions/match_item_tag_processors/associate_interaction_tag_processor.rb

Defined Under Namespace

Modules: MatchItemTagProcessors Classes: BaseInteraction, CategorizationInteraction, ChoiceInteraction, ExtendedTextInteraction, GapMatchInteraction, MatchInteraction, OrderingInteraction, ShortTextInteraction

Class Method Summary collapse

Class Method Details

.interaction_model(node, parent) ⇒ Object

This one finds the correct parsing model based on the provided xml node

Raises:

  • (V2::UnsupportedSchema)


6
7
8
9
10
11
12
13
14
15
16
# File 'lib/qti/v2/models/interactions.rb', line 6

def self.interaction_model(node, parent)
  # Check for matches
  matches = subclasses.each_with_object([]) do |interaction_class, result|
    match = interaction_class.matches(node, parent)
    result << match if match
  end

  raise V2::UnsupportedSchema if matches.size > 1

  matches.first
end

.subclassesObject



18
19
20
21
22
# File 'lib/qti/v2/models/interactions.rb', line 18

def self.subclasses
  constants.map { |c| const_get(c) }
           .reject { |c| c.name =~ /Implementations|Base/ }
           .select { |c| c.name =~ /^Qti::V2.*Interaction$/ }
end