Class: Escape::Commands::Questions

Inherits:
Base
  • Object
show all
Defined in:
lib/escape/commands/questions.rb

Instance Attribute Summary

Attributes inherited from Base

#runner

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Escape::Commands::Base

Instance Method Details

#start(questions, clues) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/escape/commands/questions.rb', line 4

def start(questions, clues)
  questions.each_with_index do |question, index|
    answer = runner.ask(question.text)
    clue = question.correct?(answer) ? Clue.new(clues).correct(index) : Clue.new(clues).incorrect(index)
    runner.say("YOUR NEXT CLUE IS '#{clue}'")
    runner.say
  end
end