Sha256: 5672513ddfc415b95d12f3c17faf2c952401b838c76bdf1ba601ae30ac59ff2f

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

require 'set'

module HarmoniousDictionary
  module RsegEngine
    LETTER_SYMBOLS = Set.new ('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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
harmonious_check-0.0.2 lib/harmonious_dictionary/engines/english.rb