Sha256: 42c8a08d1a1ded2139f1c5e69e52c2cffc4c3208d02c80b5f13b57cb34bb2ed1

Contents?: true

Size: 520 Bytes

Versions: 6

Compression:

Stored size: 520 Bytes

Contents

module DidYouMean
  module Correctable
    prepend_features NameError

    def original_message
      method(:to_s).super_method.call
    end

    def to_s
      msg = super.dup
      bt  = caller(1, 6)

      msg << Formatter.new(corrections).to_s if IGNORED_CALLERS.all? {|ignored| bt.grep(ignored).empty? }
      msg
    rescue
      super
    end

    def corrections
      spell_checker.corrections
    end

    def spell_checker
      @spell_checker ||= SPELL_CHECKERS[self.class.to_s].new(self)
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ruby-compiler-0.1.1 vendor/ruby/gems/did_you_mean-1.1.0/lib/did_you_mean/core_ext/name_error.rb
did_you_mean-1.1.0 lib/did_you_mean/core_ext/name_error.rb
did_you_mean-1.0.2 lib/did_you_mean/core_ext/name_error.rb
did_you_mean-1.0.1 lib/did_you_mean/core_ext/name_error.rb
did_you_mean-1.0.0 lib/did_you_mean/core_ext/name_error.rb
did_you_mean-1.0.0.rc1 lib/did_you_mean/core_ext/name_error.rb