Class: RsegEngine::English

Inherits:
Engine
  • Object
show all
Defined in:
lib/engines/english.rb

Instance Method Summary collapse

Methods inherited from Engine

#run, #running?, #stop

Constructor Details

#initializeEnglish

Returns a new instance of English.



5
6
7
8
# File 'lib/engines/english.rb', line 5

def initialize
  @word = ''
  super
end

Instance Method Details

#process(char) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/engines/english.rb', line 10

def process(char)
  match = false
  word = nil

  if LETTER_SYMBOLS.include?(char)
    @word << char
    match = true
  else
    word = @word
    @word = ''
    match = false
  end

  [match, word]
end