Module: Kotoshu::Dictionary
- Defined in:
- lib/kotoshu/dictionary.rb,
lib/kotoshu/dictionary/base.rb,
lib/kotoshu/dictionary/cspell.rb,
lib/kotoshu/dictionary/custom.rb,
lib/kotoshu/dictionary/unified.rb,
lib/kotoshu/dictionary/hunspell.rb,
lib/kotoshu/dictionary/plain_text.rb,
lib/kotoshu/dictionary/repository.rb,
lib/kotoshu/dictionary/unix_words.rb
Overview
Dictionary backends for different formats (Hunspell, CSpell, plain text, etc.).
Defined Under Namespace
Classes: Base, CSpell, Custom, Hunspell, PlainText, Repository, Unified, UnixWords
Class Method Summary collapse
-
.load(type, *args) ⇒ Base
Load a dictionary by type.
-
.register_type(type, klass) ⇒ Object
Register a dictionary type.
-
.registry ⇒ Hash
Module-level registry for dictionary types.
Class Method Details
.load(type, *args) ⇒ Base
Load a dictionary by type.
256 257 258 259 260 261 |
# File 'lib/kotoshu/dictionary/base.rb', line 256 def self.load(type, *args) klass = registry[type] raise ConfigurationError, "Unknown dictionary type: #{type}" unless klass klass.new(*args) end |
.register_type(type, klass) ⇒ Object
Register a dictionary type.
242 243 244 245 |
# File 'lib/kotoshu/dictionary/base.rb', line 242 def self.register_type(type, klass) @registry ||= {} @registry[type] = klass end |
.registry ⇒ Hash
Module-level registry for dictionary types.
231 232 233 |
# File 'lib/kotoshu/dictionary/base.rb', line 231 def self.registry @registry ||= {} end |