Sha256: 42a270c441136553e7792c0d03e750e012423043930bdd5757f779c424f9f95d

Contents?: true

Size: 843 Bytes

Versions: 10

Compression:

Stored size: 843 Bytes

Contents

module GhInspector
  class ExceptionHound
    attr_accessor :message

    def initialize(error)
      self.message = find_message error
    end

    def find_message(error)
      error.to_s
    end

    def query
      undefined
      simple_nil
      demangle_instances

      message
    end

    private

    def undefined
      self.message = message.gsub "undefined local variable or method", "undefined"
    end

    def simple_nil
      self.message = message.gsub "nil:NilClass", "nil"
    end

    def demangle_instances
      self.message = regex_replace(message, /(#<.*>)/, /#<(.*):/)
    end

    def regex_replace(string, find, replace)
      if string.match find
        full = string.match(find)[0]
        simple = string.match(replace)[1]
        string.gsub full, simple
      else
        string
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
cocoapods-dependency-html-0.0.2 vendor/bundle/gems/gh_inspector-1.1.3/lib/gh_inspector/exception_hound.rb
cocoapods-dependency-html-0.0.1 vendor/bundle/gems/gh_inspector-1.1.3/lib/gh_inspector/exception_hound.rb
gh_inspector-1.1.3 lib/gh_inspector/exception_hound.rb
gh_inspector-1.1.2 lib/gh_inspector/exception_hound.rb
gh_inspector-1.1.1 lib/gh_inspector/exception_hound.rb
gh_inspector-1.1.0 lib/gh_inspector/exception_hound.rb
gh_inspector-1.0.3 lib/gh_inspector/exception_hound.rb
gh_inspector-1.0.2 lib/gh_inspector/exception_hound.rb
gh_inspector-1.0.1 lib/gh_inspector/exception_hound.rb
gh_inspector-1.0.0 lib/gh_inspector/exception_hound.rb