Class: HarmoniousDictionary::RsegEngine::English

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

Instance Method Summary collapse

Methods inherited from Engine

#run, #running?, #stop

Constructor Details

#initializeEnglish

Returns a new instance of English.



8
9
10
11
# File 'lib/harmonious_dictionary/engines/english.rb', line 8

def initialize
  @word = ''
  super
end

Instance Method Details

#process(char) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/harmonious_dictionary/engines/english.rb', line 13

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