class Dictation::Teacher

Constants

SLEEP_INTERVAL_GENERAL
SLEEP_INTERVAL_READ_LETTER
SLEEP_INTERVAL_WRITE_LETTER

Public Class Methods

new(tts_dictate, tts_verify) click to toggle source
# File lib/dictation/teacher.rb, line 7
def initialize(tts_dictate, tts_verify)
  @tts_dictate = tts_dictate
  @tts_verify = tts_verify
end

Public Instance Methods

dictates(words) click to toggle source
# File lib/dictation/teacher.rb, line 12
def dictates(words)
  words.each do |word|
    vocabulary = word.value
    @tts_dictate.speak(vocabulary)
    sleep(vocabulary.length * SLEEP_INTERVAL_WRITE_LETTER)
  end
end
verifies(words) click to toggle source
# File lib/dictation/teacher.rb, line 20
def verifies(words)
  words.each do |word|
    @tts_dictate.speak(word.value)
    sleep(SLEEP_INTERVAL_GENERAL)
    word.orthography.each do |letter|
      @tts_dictate.speak(letter)
      sleep(SLEEP_INTERVAL_READ_LETTER)
    end
    sleep(SLEEP_INTERVAL_GENERAL)
    @tts_verify.speak(word.translation)
    puts word.value + '     ' + word.translation
    sleep(SLEEP_INTERVAL_GENERAL)
  end
end