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

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

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, #scoring_data_structs, #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
# File 'lib/qti/v1/models/interactions/string_interaction.rb', line 7

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

Instance Method Details

#rceObject



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

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

#spell_checkObject



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

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

#word_countObject



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

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

#word_limit_enabledObject



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

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

#word_limit_maxObject



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

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

#word_limit_minObject



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

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