Class: Qti::V1::Models::Interactions::OrderingInteraction
- Inherits:
-
ChoiceInteraction
- Object
- Models::Base
- Base
- BaseInteraction
- ChoiceInteraction
- Qti::V1::Models::Interactions::OrderingInteraction
- Defined in:
- lib/qti/v1/models/interactions/ordering_interaction.rb
Instance Attribute Summary
Attributes inherited from BaseInteraction
Attributes inherited from Models::Base
#doc, #manifest, #package_root, #path, #resource
Class Method Summary collapse
-
.matches(node, parent) ⇒ Object
This will know if a class matches.
Instance Method Summary collapse
- #bottom_label ⇒ Object
- #display_answers_paragraph ⇒ Object
- #scoring_data_structs ⇒ Object
- #top_label ⇒ Object
Methods inherited from ChoiceInteraction
#answers, maybe_choice_type, #meta_type, #scoring_algorithm
Methods inherited from BaseInteraction
#answer_feedback, canvas_custom_fitb?, #canvas_item_feedback, canvas_multiple_fib?, #initialize, #locked_choices, maybe_question_type, new_quizzes_fib?, question_type, #rcardinality, #shuffled?
Methods inherited from Base
#qti_version, #return_inner_content!, #sanitize_attributes, #sanitize_attributes_by_node
Methods inherited from Models::Base
#css_with_single_check, from_path!, #initialize, #parse_html, #parse_xml, #preprocess_xml_doc, #raise_unsupported, #remap_href_path, #sanitize_content!, #xpath_with_single_check
Constructor Details
This class inherits a constructor from Qti::V1::Models::Interactions::BaseInteraction
Class Method Details
.matches(node, parent) ⇒ Object
This will know if a class matches
7 8 9 10 11 12 13 |
# File 'lib/qti/v1/models/interactions/ordering_interaction.rb', line 7 def self.matches(node, parent) matches = node.xpath('.//xmlns:response_lid') return false if matches.count > 1 || matches.empty? rcardinality = matches.first.attributes['rcardinality']&.value || 'Single' return false if rcardinality != 'Ordered' new(node, parent) end |
Instance Method Details
#bottom_label ⇒ Object
19 20 21 |
# File 'lib/qti/v1/models/interactions/ordering_interaction.rb', line 19 def bottom_label @bottom_label ||= label_at_position('bottom') end |
#display_answers_paragraph ⇒ Object
28 29 30 31 32 33 |
# File 'lib/qti/v1/models/interactions/ordering_interaction.rb', line 28 def display_answers_paragraph render_extension = node.at_xpath('.//xmlns:render_extension') ims_render_object = render_extension&.at_xpath('.//xmlns:ims_render_object') ims_render_object&.attributes&.[]('orientation')&.value&.downcase == 'row' || false end |
#scoring_data_structs ⇒ Object
23 24 25 26 |
# File 'lib/qti/v1/models/interactions/ordering_interaction.rb', line 23 def scoring_data_structs correct_order = node.xpath('.//xmlns:varequal').map(&:content) correct_order.map { |id| ScoringData.new(id, rcardinality) } end |
#top_label ⇒ Object
15 16 17 |
# File 'lib/qti/v1/models/interactions/ordering_interaction.rb', line 15 def top_label @top_label ||= label_at_position('top') end |