PullReview stats Build
Status

QuizMaster

This is a gem which will contain the components necessary to create multiple choice tests, and generate question and answer sheets for those tests.

It is currently in a pre-release state as I experiment with its internal structure and use it as a "programming exercise yard".

Installation

Add this line to your application's Gemfile:

gem 'quiz_master'

And then execute:

$ bundle

Or install it yourself as:

$ gem install quiz_master

Usage

As of release 0.0.3 it can generate reordered quizzes like this:

#!/usr/bin/env ruby

require "rubygems"
require "quiz_master"
include QuizMaster

quiz_source = Quiz.new(
  [
    {
      prompt: "Who were orignal members of Genesis?",
      answers: [
        Answer.new("Phil Collins", false, tag: "phil"),
        Answer.new("Tony Banks", true),
        Answer.new("Steve Hackett", false, tag: "steve"),
        Answer.new("{{phil}} and {{steve}}", false)
      ]
    },
    {
      prompt: "Which numbers are prime?",
      answers: [
        Answer.new("1", false),
        Answer.new("2", false, tag: "2"),
        Answer.new("3", false),
        Answer.new("All of the above except {{2}}", true, anchored: true)
      ]
    },
    {
      prompt: "What is the colour of a Banana?",
      answers: [
        Answer.new("Green", false),
        Answer.new("Red", false, tag: "red"),
        Answer.new("Yellow", false),
        Answer.new("Black", false),
        Answer.new("Brown", false),
        Answer.new("Blue", false, tag: "blue"),
        Answer.new("All of the colours above", false, anchored: true),
        Answer.new("All of the colours above except {{blue}} and {{red}}", true,
                   anchored: true)
      ]
    }
  ].map { |q| Question.new(q) })

3.times do
  answer_reorderings = quiz_source.answer_reordering_vectors
  question_reordering = quiz_source.question_reordering_vector

  quiz = QuizVariant.new(quiz_source, answer_reorderings, question_reordering)

  puts TextQuestionSheetFormatter.new.format(quiz)
  puts TextAnswerSheetFormatter.new.format(quiz)
end

Generating three (probably) different versions of the same quiz and an answer sheet for each.

Contributing

  1. Fork it ( https://github.com/mikestok/quiz_master/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request