Skip to content

Commit

Permalink
Removed deprecated constants for Ruby 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Dec 2, 2024
1 parent 94c7e8c commit e11bf81
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions lib/did_you_mean.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,30 +113,6 @@ def self.correct_error(error_class, spell_checker)
correct_error LoadError, RequirePathChecker if RUBY_VERSION >= '2.8.0'
correct_error NoMatchingPatternKeyError, PatternKeyNameChecker if defined?(::NoMatchingPatternKeyError)

# TODO: Remove on the 3.4 development start:
class DeprecatedMapping # :nodoc:
def []=(key, value)
warn "Calling `DidYouMean::SPELL_CHECKERS[#{key.to_s}] = #{value.to_s}' has been deprecated. " \
"Please call `DidYouMean.correct_error(#{key.to_s}, #{value.to_s})' instead."

DidYouMean.correct_error(key, value)
end

def merge!(hash)
warn "Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. " \
"Please call `DidYouMean.correct_error(error_name, spell_checker)' instead."

hash.each do |error_class, spell_checker|
DidYouMean.correct_error(error_class, spell_checker)
end
end
end

# TODO: Remove on the 3.4 development start:
SPELL_CHECKERS = DeprecatedMapping.new
deprecate_constant :SPELL_CHECKERS
private_constant :DeprecatedMapping

# Returns the currently set formatter. By default, it is set to +DidYouMean::Formatter+.
def self.formatter
if defined?(Ractor)
Expand Down

0 comments on commit e11bf81

Please sign in to comment.