class AlfonsoX::SpellChecker::Dictionary::Default

Default dictionary loader

Constants

KEYWORDS

Ruby keywords

OTHERS

Other common but erroneous words in the Ruby-development world

Public Class Methods

new() click to toggle source

Initialize this default dictionary for Ruby code

# File lib/alfonsox/spellchecker/dictionary/default.rb, line 86
def initialize
  @words = (KEYWORDS + OTHERS).map(&:downcase)
end

Public Instance Methods

word_present?(word) click to toggle source

Check if a word is present in the dictionary. @param [String] word Word to be checked. @return [Boolean] true if the word is in the dictionary, false otherwise.

# File lib/alfonsox/spellchecker/dictionary/default.rb, line 93
def word_present?(word)
  @words.include?(word.downcase)
end