Sha256: 342309dc47b889e71bb6439c8fff6539cfba69ac4f5307f6ef871082d1f021b0

Contents?: true

Size: 367 Bytes

Versions: 5

Compression:

Stored size: 367 Bytes

Contents

LETTER_SYMBOLS = ('a'..'z').to_a + ('A'..'Z').to_a

class English < Engine
  def initialize
    @word = ''
    super
  end
  
  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  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rseg-0.1.5 lib/engines/english.rb
rseg-0.1.4 lib/engines/english.rb
rseg-0.1.3 lib/engines/english.rb
rseg-0.1.2 lib/engines/english.rb
rseg-0.1.1 lib/engines/english.rb