Module: Forspell::WordMatcher

Defined in:
lib/forspell/word_matcher.rb

Constant Summary collapse

WORD =
%r{^
  ([a-z]|[A-Z])                 # at least one letter,
  ([[:lower:]])*                # then any number of letters,
  ([\'\-][[:lower:]])?          # optional dash/apostrophe, followed by letter
  ([[:lower:]])*                # another bunch of letters
$}x

Class Method Summary collapse

Class Method Details

.word?(text) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/forspell/word_matcher.rb', line 12

def self.word? text
  WORD.match?(text)
end