brew vendor-gems: commit updates.
This commit is contained in:
parent
9bc0891f49
commit
a63ab9372a
@ -43,7 +43,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
|
|||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/highline-2.0.3/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/highline-2.0.3/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/commander-4.6.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/commander-4.6.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/connection_pool-2.3.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/connection_pool-2.3.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/did_you_mean-1.6.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/did_you_mean-1.6.2/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/diff-lcs-1.5.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/diff-lcs-1.5.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/docile-1.4.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/docile-1.4.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/unf_ext-0.0.8.2")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/unf_ext-0.0.8.2")
|
||||||
|
|||||||
@ -1,32 +0,0 @@
|
|||||||
module DidYouMean
|
|
||||||
module Correctable
|
|
||||||
SKIP_TO_S_FOR_SUPER_LOOKUP = true
|
|
||||||
private_constant :SKIP_TO_S_FOR_SUPER_LOOKUP
|
|
||||||
|
|
||||||
def original_message
|
|
||||||
meth = method(:to_s)
|
|
||||||
while meth.owner.const_defined?(:SKIP_TO_S_FOR_SUPER_LOOKUP)
|
|
||||||
meth = meth.super_method
|
|
||||||
end
|
|
||||||
meth.call
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_s
|
|
||||||
msg = super.dup
|
|
||||||
suggestion = DidYouMean.formatter.message_for(corrections)
|
|
||||||
|
|
||||||
msg << suggestion if !msg.include?(suggestion)
|
|
||||||
msg
|
|
||||||
rescue
|
|
||||||
super
|
|
||||||
end
|
|
||||||
|
|
||||||
def corrections
|
|
||||||
@corrections ||= spell_checker.corrections
|
|
||||||
end
|
|
||||||
|
|
||||||
def spell_checker
|
|
||||||
DidYouMean.spell_checkers[self.class.to_s].new(self)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
module DidYouMean
|
|
||||||
VERSION = "1.6.1".freeze
|
|
||||||
end
|
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
module DidYouMean
|
||||||
|
module Correctable
|
||||||
|
if Exception.method_defined?(:detailed_message)
|
||||||
|
# just for compatibility
|
||||||
|
def original_message
|
||||||
|
# we cannot use alias here because
|
||||||
|
to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
def detailed_message(highlight: true, did_you_mean: true, **)
|
||||||
|
msg = super.dup
|
||||||
|
|
||||||
|
return msg unless did_you_mean
|
||||||
|
|
||||||
|
suggestion = DidYouMean.formatter.message_for(corrections)
|
||||||
|
|
||||||
|
if highlight
|
||||||
|
suggestion = suggestion.gsub(/.+/) { "\e[1m" + $& + "\e[m" }
|
||||||
|
end
|
||||||
|
|
||||||
|
msg << suggestion
|
||||||
|
msg
|
||||||
|
rescue
|
||||||
|
super
|
||||||
|
end
|
||||||
|
else
|
||||||
|
SKIP_TO_S_FOR_SUPER_LOOKUP = true
|
||||||
|
private_constant :SKIP_TO_S_FOR_SUPER_LOOKUP
|
||||||
|
|
||||||
|
def original_message
|
||||||
|
meth = method(:to_s)
|
||||||
|
while meth.owner.const_defined?(:SKIP_TO_S_FOR_SUPER_LOOKUP)
|
||||||
|
meth = meth.super_method
|
||||||
|
end
|
||||||
|
meth.call
|
||||||
|
end
|
||||||
|
|
||||||
|
def to_s
|
||||||
|
msg = super.dup
|
||||||
|
suggestion = DidYouMean.formatter.message_for(corrections)
|
||||||
|
|
||||||
|
msg << suggestion if !msg.include?(suggestion)
|
||||||
|
msg
|
||||||
|
rescue
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def corrections
|
||||||
|
@corrections ||= spell_checker.corrections
|
||||||
|
end
|
||||||
|
|
||||||
|
def spell_checker
|
||||||
|
DidYouMean.spell_checkers[self.class.to_s].new(self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -1,8 +1,9 @@
|
|||||||
|
# frozen-string-literal: true
|
||||||
|
|
||||||
warn "`require 'did_you_mean/formatters/verbose_formatter'` is deprecated and falls back to the default formatter. "
|
warn "`require 'did_you_mean/formatters/verbose_formatter'` is deprecated and falls back to the default formatter. "
|
||||||
|
|
||||||
require_relative '../formatter'
|
require_relative '../formatter'
|
||||||
|
|
||||||
# frozen-string-literal: true
|
|
||||||
module DidYouMean
|
module DidYouMean
|
||||||
# For compatibility:
|
# For compatibility:
|
||||||
VerboseFormatter = Formatter
|
VerboseFormatter = Formatter
|
||||||
@ -79,7 +79,7 @@ module DidYouMean
|
|||||||
def corrections
|
def corrections
|
||||||
@corrections ||= SpellChecker
|
@corrections ||= SpellChecker
|
||||||
.new(dictionary: (RB_RESERVED_WORDS + lvar_names + method_names + ivar_names + cvar_names))
|
.new(dictionary: (RB_RESERVED_WORDS + lvar_names + method_names + ivar_names + cvar_names))
|
||||||
.correct(name) - NAMES_TO_EXCLUDE[@name]
|
.correct(name).uniq - NAMES_TO_EXCLUDE[@name]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
module DidYouMean
|
||||||
|
VERSION = "1.6.2".freeze
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user