class Spirit::Render::Multi

Renders multiple choice questions marked up in YAML as HTML. @example

"""
format: multi
question: How tall is Mount Everest?
answer: A
options:
  A: 452 inches
  B: 8.85 kilometers
"""

Constants

OPTIONS

Required key in YAML markup. Associated value should be a dictionary of label -> choices.

Public Instance Methods

valid?() click to toggle source

Checks if the given yaml contains a valid MCQ. @return [Boolean] true iff the yaml contains a valid MCQ.

Calls superclass method
# File lib/spirit/render/templates/multi.rb, line 28
def valid?
  super and
    @yaml[ANSWER].is_a? String and
    @yaml.has_key?(OPTIONS) and
    @yaml[OPTIONS].is_a? Hash
end