Class: Dictation::Typewriter

Inherits:
Object
  • Object
show all
Defined in:
lib/dictation/typewriter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTypewriter

Returns a new instance of Typewriter.



5
6
7
# File 'lib/dictation/typewriter.rb', line 5

def initialize
  @words = []
end

Instance Attribute Details

#wordsObject

Returns the value of attribute words.



3
4
5
# File 'lib/dictation/typewriter.rb', line 3

def words
  @words
end

Instance Method Details

#collectObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/dictation/typewriter.rb', line 22

def collect
  paint_puts('Please type word and translation one by one, press Enter key to save.  When you finish, press Ctrl+C.', :pink)
  Signal.trap('SIGINT') do
    puts ''
    break
  end
  loop do
    record
  end
  paint_puts("=" * 80, :green)
  paint_puts("Input is done.", :green)
  @words
end