Class: Hemlock::Turn

Inherits:
Object
  • Object
show all
Defined in:
lib/hemlock/turn.rb

Instance Method Summary collapse

Constructor Details

#initialize(flashcard) ⇒ Turn

Returns a new instance of Turn.



7
8
9
# File 'lib/hemlock/turn.rb', line 7

def initialize(flashcard)
  @flashcard = flashcard
end

Instance Method Details

#take_turnObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/hemlock/turn.rb', line 11

def take_turn
  puts @flashcard.question
  guess = Readline.readline('>> ', false)
  if @flashcard.correct?(guess)
    puts Rainbow('Correct').green
  else
    puts Rainbow('You must submit to the quarries').red
    punishment
  end
end