Exception: Kotoshu::ResourceNotSetupError

Inherits:
Error
  • Object
show all
Defined in:
lib/kotoshu/core/exceptions.rb

Overview

Error raised by the hot path (Kotoshu.correct?, .suggest, .check, .check_file, .spellchecker_for) when a language hasn’t been set up via Kotoshu.setup / kotoshu setup. The hot path is cache-only and never downloads — explicit setup is required.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(language, resource_type = "spelling") ⇒ ResourceNotSetupError

Returns a new instance of ResourceNotSetupError.



123
124
125
126
127
128
129
# File 'lib/kotoshu/core/exceptions.rb', line 123

def initialize(language, resource_type = "spelling")
  @language = language
  @resource_type = resource_type
  super("Language '#{language}' is not set up (missing #{resource_type}). " \
        "Run `kotoshu setup #{language}` or " \
        "`Kotoshu.setup(:#{language})` first.")
end

Instance Attribute Details

#languageObject (readonly)

Returns the value of attribute language.



131
132
133
# File 'lib/kotoshu/core/exceptions.rb', line 131

def language
  @language
end

#resource_typeObject (readonly)

Returns the value of attribute resource_type.



131
132
133
# File 'lib/kotoshu/core/exceptions.rb', line 131

def resource_type
  @resource_type
end