Dumb fork of https://github.com/nilsding/questiongenerator/ that makes it easier to maintain the question lists
Go to file
Adel Duprat-Kissami faab2a2d4f ENGAGE THE BAGUETTE MOTHERF#CKER
(obviously not final)
2015-06-09 18:54:56 +02:00
lib ENGAGE THE BAGUETTE MOTHERF#CKER 2015-06-09 18:54:56 +02:00
.gitignore updated gitignore 2014-12-12 14:07:20 +01:00
Gemfile initial commit 2014-12-09 00:59:33 +01:00
LICENSE.txt initial commit 2014-12-09 00:59:33 +01:00
README.md fixed example 2015-05-24 22:37:59 +02:00
Rakefile initial commit 2014-12-09 00:59:33 +01:00
questiongenerator.gemspec 0.1.0! 2015-01-18 01:05:42 +01:00

README.md

questiongenerator

A simple question generator, used by Retrospring (formerly justask).

Installation

Add this line to your application's Gemfile:

gem 'questiongenerator'

If you're feeling edgy, you can add this line instead:

gem 'questiongenerator', git: 'https://github.com/retrospring/questiongenerator.git'

Usage

require 'questiongenerator'

# Configure it
QuestionGenerator.question_base_path = '/home/nilsding/questions'
QuestionGenerator.default_locale = :en

# Compile the questions for increased randomness
QuestionGenerator.compile

# Get some questions
puts QuestionGenerator.generate
# => "What is the best thing about the internet?"

# You can also specify the locale, if you want to
puts QuestionGenerator.generate locale: :de
# => "Was war das letzte, das du gegessen hast?"

How it works

The question generator uses a simple branching structure inside the specified locale to generate questions from it, here is a quick example:

Can:
  you:
    - swim
    - speak:
      - different:
        - languages
    - play:
      - any:
        - sports
      - the:
        - piano
        - guitar
        - trumpet
      - baseball
    - ski
    - cook
    - dance

# The following example outputs:
# Can you swim?
# Can you speak different languages?
# Can you play any sports?
# Can you play the piano?
#               ...guitar?
#               ...trumpet?
# Can you play baseball?
# Can you ski?
# Can you cook?
# Can you dance?

If you can't break sentences in parts in your language, you can also specify the entire question in one line.

- Can you swim

# The following example outputs:
# Can you swim?

Contributing

The files for questions are located in lib/questions/

If you want to add a new language, create a new file and name it with the ISO-639-1 language code of it (just like en.yml)

  1. Fork it ( https://github.com/retrospring/questiongenerator/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

Please don't add harassing, scaring or upsetting content to the questions or content that otherwise violates the Retrospring Terms of Service.

If you add questions in another language to the questiongenerator and purposely add wrong translations, further Pull Requests will be ignored.