class Qti::V1::Models::Base

Public Instance Methods

qti_version() click to toggle source
# File lib/qti/v1/models/base.rb, line 5
def qti_version
  1
end
return_inner_content!(node) click to toggle source
# File lib/qti/v1/models/base.rb, line 9
def return_inner_content!(node)
  return CGI.unescapeHTML(node.inner_html).html_safe if html_node?(node)
  return node.text if text_node?(node)
  node.inner_html
end

Private Instance Methods

html_node?(node) click to toggle source
# File lib/qti/v1/models/base.rb, line 22
def html_node?(node)
  node.attributes['texttype']&.value == 'text/html'
end
text_node?(node) click to toggle source
# File lib/qti/v1/models/base.rb, line 17
def text_node?(node)
  node.attributes['texttype']&.value == 'text/plain' ||
    node.child&.cdata? || node.inner_html.include?('&gt' || '&lt')
end