Module: Spellchecker::Dictionaries::HumanNames::FirstNames

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

Overview

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.allSet<String>

Returns:

  • (Set<String>)


14
15
16
17
18
# File 'lib/spellchecker/dictionaries/human_names.rb', line 14

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

.include?(string) ⇒ Boolean

Parameters:

  • string (String)

Returns:

  • (Boolean)


22
23
24
25
26
27
28
# File 'lib/spellchecker/dictionaries/human_names.rb', line 22

def include?(string)
  return false unless string

  string = Utils.remove_suffix(string.downcase)

  all.include?(string)
end