Module: Spellchecker::Dictionaries::HumanNames::LastNames

Defined in:
lib/spellchecker/dictionaries/human_names.rb

Constant Summary collapse

MUTEX =
Mutex.new
PATH =
Dictionaries.path.join('last_names.txt')

Class Method Summary collapse

Class Method Details

.allSet<String>

Returns:

  • (Set<String>)


38
39
40
41
42
# File 'lib/spellchecker/dictionaries/human_names.rb', line 38

def all
  @all || MUTEX.synchronize do
    @all ||= Set.new(PATH.read.split("\n"))
  end
end

.include?(string) ⇒ Boolean

Parameters:

  • string (String)

Returns:

  • (Boolean)


46
47
48
49
50
51
52
# File 'lib/spellchecker/dictionaries/human_names.rb', line 46

def include?(string)
  return false unless string

  string = Utils.remove_suffix(string.downcase)

  all.include?(string)
end