Class: Qti::V1::Models::Interactions::BaseInteraction
- Inherits:
-
Base
- Object
- Models::Base
- Base
- Qti::V1::Models::Interactions::BaseInteraction
- Defined in:
- lib/qti/v1/models/interactions/base_interaction.rb
Direct Known Subclasses
ChoiceInteraction, FillBlankInteraction, MatchInteraction, NumericInteraction, StringInteraction
Constant Summary
Constants inherited from Models::Base
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Attributes inherited from Models::Base
#doc, #manifest, #package_root, #path
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(node, parent) ⇒ BaseInteraction
constructor
A new instance of BaseInteraction.
- #rcardinality ⇒ Object
- #scoring_data_structs ⇒ Object
- #shuffled? ⇒ Boolean
Methods inherited from Base
#qti_version, #return_inner_content!
Methods inherited from Models::Base
#css_with_single_check, from_path!, #object_tag_transformer, #parse_html, #parse_xml, #remap_href_path, #remap_unknown_tags_transformer, #sanitize_config, #sanitize_content!, #xpath_with_single_check
Constructor Details
#initialize(node, parent) ⇒ BaseInteraction
Returns a new instance of BaseInteraction.
18 19 20 21 |
# File 'lib/qti/v1/models/interactions/base_interaction.rb', line 18 def initialize(node, parent) @node = node copy_paths_from_item(parent) end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
6 7 8 |
# File 'lib/qti/v1/models/interactions/base_interaction.rb', line 6 def node @node end |
Class Method Details
.canvas_multiple_fib?(node) ⇒ Boolean
12 13 14 15 16 |
# File 'lib/qti/v1/models/interactions/base_interaction.rb', line 12 def self.canvas_multiple_fib?(node) matches = node.xpath('.//xmlns:response_lid') return false if matches.count <= 1 node.at_xpath('.//xmlns:fieldentry').text == "fill_in_multiple_blanks_question" end |
.matches(_node, _parent) ⇒ Object
8 9 10 |
# File 'lib/qti/v1/models/interactions/base_interaction.rb', line 8 def self.matches(_node, _parent) false end |
Instance Method Details
#rcardinality ⇒ Object
31 32 33 |
# File 'lib/qti/v1/models/interactions/base_interaction.rb', line 31 def rcardinality @rcardinality ||= @node.at_xpath('.//xmlns:response_lid/@rcardinality')&.value || 'Single' end |
#scoring_data_structs ⇒ Object
27 28 29 |
# File 'lib/qti/v1/models/interactions/base_interaction.rb', line 27 def scoring_data_structs raise NotImplementedError end |
#shuffled? ⇒ Boolean
23 24 25 |
# File 'lib/qti/v1/models/interactions/base_interaction.rb', line 23 def shuffled? @node.at_xpath('.//xmlns:render_choice/@shuffle')&.value.try(:downcase) == 'yes' end |