Class: Spirit::Render::Short

Inherits:
Problem show all
Defined in:
lib/spirit/render/templates/short.rb

Overview

Renders short questions marked up in YAML as HTML.

Examples:

{
  "format": "short",
  "question": "What is the most commonly used word in English?",
  "answer": "the"
}

Constant Summary

Constants inherited from Problem

Problem::ANSWER, Problem::FORMAT, Problem::ID, Problem::KEYS, Problem::QUESTION

Instance Attribute Summary

Attributes inherited from Problem

#digest, #id, #nesting

Instance Method Summary collapse

Methods inherited from Problem

accessor, #answer, get_instance, #initialize, parse, #render

Methods inherited from Template

#render

Constructor Details

This class inherits a constructor from Spirit::Render::Problem

Instance Method Details

#valid?Boolean

Checks if the given yaml contains a valid MCQ.

Returns:

  • (Boolean)

    true iff the yaml contains a valid MCQ.



20
21
22
# File 'lib/spirit/render/templates/short.rb', line 20

def valid?
  super and not @yaml[ANSWER].nil?
end