class method
DidYouMean.correct_error
correct_error(error_class, spell_checker)
lib/did_you_mean.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/did_you_mean.rb, line 97
def self.correct_error(error_class, spell_checker)
if defined?(Ractor)
new_mapping = { **@spell_checkers, error_class.to_s => spell_checker }
new_mapping.default = NullChecker
@spell_checkers = Ractor.make_shareable(new_mapping)
else
spell_checkers[error_class.to_s] = spell_checker
end
error_class.prepend(Correctable) if error_class.is_a?(Class) && !(error_class < Correctable)
end
Adds DidYouMean functionality to an error using a given spell checker