Class: Dictation::Teacher
- Inherits:
-
Object
- Object
- Dictation::Teacher
- Defined in:
- lib/dictation/teacher.rb
Constant Summary collapse
- SLEEP_INTERVAL_WRITE_LETTER =
0.8
- SLEEP_INTERVAL_READ_LETTER =
0.1
- SLEEP_INTERVAL_GENERAL =
0.5
Instance Method Summary collapse
- #dictates(words) ⇒ Object
-
#initialize(tts_dictate, tts_verify) ⇒ Teacher
constructor
A new instance of Teacher.
- #verifies(words) ⇒ Object
Constructor Details
#initialize(tts_dictate, tts_verify) ⇒ Teacher
Returns a new instance of Teacher.
7 8 9 10 |
# File 'lib/dictation/teacher.rb', line 7 def initialize(tts_dictate, tts_verify) @tts_dictate = tts_dictate @tts_verify = tts_verify end |
Instance Method Details
#dictates(words) ⇒ Object
12 13 14 15 16 17 18 |
# 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) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# 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 |