Class: Qti::V2::Models::Choices::SimpleChoice
- Inherits:
-
Base
- Object
- Models::Base
- Base
- Qti::V2::Models::Choices::SimpleChoice
- Defined in:
- lib/qti/v2/models/choices/simple_choice.rb
Constant Summary collapse
- PROHIBITED_NODE_NAMES =
%w(feedbackInline).join(',').freeze
Constants inherited from Base
Base::BODY_ELEMENTS_CSS, Base::CHOICE_ELEMENTS_CSS, Base::INTERACTION_ELEMENTS_CSS
Constants inherited from Models::Base
Instance Method Summary collapse
- #identifier ⇒ Object
-
#initialize(node) ⇒ SimpleChoice
constructor
A new instance of SimpleChoice.
- #item_body ⇒ Object
Methods inherited from Base
Methods inherited from Models::Base
#css_with_single_check, from_path!, #parse_xml, #remap_href_path, #remap_unknown_tags_transformer, #sanitize_config, #sanitize_content!, #xpath_with_single_check
Constructor Details
#initialize(node) ⇒ SimpleChoice
Returns a new instance of SimpleChoice.
9 10 11 |
# File 'lib/qti/v2/models/choices/simple_choice.rb', line 9 def initialize(node) @node = node end |
Instance Method Details
#identifier ⇒ Object
13 14 15 |
# File 'lib/qti/v2/models/choices/simple_choice.rb', line 13 def identifier @identifier ||= @node.attributes['identifier'].value end |
#item_body ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/qti/v2/models/choices/simple_choice.rb', line 17 def item_body @item_body ||= begin node = @node.dup node.children.filter(PROHIBITED_NODE_NAMES).map(&:unlink) node.content.strip.gsub(/\s+/, ' ') end end |