module Qti::V2::Models::Interactions

Public Class Methods

interaction_model(node, parent) click to toggle source

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

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