Class: Qti::V1::Models::Interactions::StringInteraction

Inherits:
BaseInteraction show all
Defined in:
lib/qti/v1/models/interactions/string_interaction.rb

Overview

This is the Interaction for Essay question type

Instance Attribute Summary

Attributes inherited from BaseInteraction

#node

Attributes inherited from Models::Base

#doc, #manifest, #package_root, #path, #resource

Class Method Summary collapse

Instance Method Summary collapse

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, #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



8
9
10
11
12
# File 'lib/qti/v1/models/interactions/string_interaction.rb', line 8

def self.matches(node, parent)
  matches = node.xpath('.//xmlns:render_fib')
  return false if matches.empty?
  new(node, parent)
end

Instance Method Details

#rceObject



14
15
16
# File 'lib/qti/v1/models/interactions/string_interaction.rb', line 14

def rce
  @rce ||= (rce_raw.nil? || rce_raw.downcase == 'yes')
end

#scoring_data_structsObject



39
40
41
# File 'lib/qti/v1/models/interactions/string_interaction.rb', line 39

def scoring_data_structs
  { value: grading_notes }
end

#spell_checkObject



22
23
24
# File 'lib/qti/v1/models/interactions/string_interaction.rb', line 22

def spell_check
  @spell_check ||= @node.at_xpath('.//xmlns:response_str/@spell_check')&.value&.downcase == 'yes'
end

#word_countObject



18
19
20
# File 'lib/qti/v1/models/interactions/string_interaction.rb', line 18

def word_count
  @word_count ||= @node.at_xpath('.//xmlns:response_str/@word_count')&.value&.downcase == 'yes'
end

#word_limit_enabledObject



26
27
28
29
# File 'lib/qti/v1/models/interactions/string_interaction.rb', line 26

def word_limit_enabled
  @word_limit_enabled ||=
    @node.at_xpath('.//xmlns:response_str/@word_limit_enabled')&.value&.downcase == 'yes'
end

#word_limit_maxObject



31
32
33
# File 'lib/qti/v1/models/interactions/string_interaction.rb', line 31

def word_limit_max
  @word_limit_max ||= @node.at_xpath('.//xmlns:response_str/@word_limit_max')&.value
end

#word_limit_minObject



35
36
37
# File 'lib/qti/v1/models/interactions/string_interaction.rb', line 35

def word_limit_min
  @word_limit_min ||= @node.at_xpath('.//xmlns:response_str/@word_limit_min')&.value
end