Sha256: b3cfcdaef26c6b6d36726e74bde981e711824f23b069731bc8ead7ea4481943d

Contents?: true

Size: 635 Bytes

Versions: 4

Compression:

Stored size: 635 Bytes

Contents

# ~*~ encoding: utf-8 ~*~
module Spirit

  module Render

    # Renders short questions marked up in YAML as HTML.
    # @example
    #     {
    #       "format": "short",
    #       "question": "What is the most commonly used word in English?",
    #       "answer": "the"
    #     }
    class Short < Problem

      # Name of template file for rendering short answer questions.
      TEMPLATE = 'short.haml'

      # Checks if the given yaml contains a valid MCQ.
      # @return [Boolean] true iff the yaml contains a valid MCQ.
      def valid?
        super and
          not @yaml[ANSWER].nil?
      end

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spirit-0.2 lib/spirit/render/templates/short.rb
spirit-0.1.0.pre.2 lib/spirit/render/templates/short.rb
spirit-0.1.0.pre.1 lib/spirit/render/templates/short.rb
spirit-0.1.0.pre lib/spirit/render/templates/short.rb