Class: GhInspector::Inspector

Inherits:
Object
  • Object
show all
Defined in:
lib/gh_inspector/inspector.rb

Overview

To get started using The Issues Inspector, you will need to create an inspector instance. This class is main public API for querying issues.

#### Getting Started

Create an instance of ‘GhInspector::Inspector`, you can then ask it to search based on your raised exception, or as a direct query yourself.

“‘ ruby require ’gh_inspector’ inspector = GhInspector::Inspector.new “orta”, “eigen” inspector.search_query “Someone set us up the bomb” “‘

By default this would output:

“‘ Looking for related issues on CocoaPods/CocoaPods…

- undefined method `to_ary' for #<Pod::Specification name="iVersion">Did you mean? to_query
  https://github.com/CocoaPods/CocoaPods/issues/4748 [closed] [1 comment]

- NoMethodError - undefined method `to_ary' for Pod EAIntroView
  https://github.com/CocoaPods/CocoaPods/issues/4391 [closed] [15 comments]

- Do a search on GitHub for issues relating to a crash?
  https://github.com/CocoaPods/CocoaPods/issues/4391 [open] [3 comments]

and 10 more at: github.com/CocoaPods/CocoaPods/search?q=undefined+method+%60to_ary%27&type=Issues “‘

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo_owner, repo_name, verbose: false) ⇒ Inspector

Init function with “orta”, “project”



48
49
50
51
52
53
# File 'lib/gh_inspector/inspector.rb', line 48

def initialize(repo_owner, repo_name, verbose: false)
  self.repo_owner = repo_owner
  self.repo_name = repo_name
  self.verbose = verbose
  self.sidekick = Sidekick.new(self, repo_owner, repo_name)
end

Instance Attribute Details

#queryObject

Returns the value of attribute query.



39
40
41
# File 'lib/gh_inspector/inspector.rb', line 39

def query
  @query
end

#repo_nameObject

Returns the value of attribute repo_name.



39
40
41
# File 'lib/gh_inspector/inspector.rb', line 39

def repo_name
  @repo_name
end

#repo_ownerObject

Returns the value of attribute repo_owner.



39
40
41
# File 'lib/gh_inspector/inspector.rb', line 39

def repo_owner
  @repo_owner
end

#sidekickObject

Returns the value of attribute sidekick.



39
40
41
# File 'lib/gh_inspector/inspector.rb', line 39

def sidekick
  @sidekick
end

#verboseObject

Returns the value of attribute verbose.



39
40
41
# File 'lib/gh_inspector/inspector.rb', line 39

def verbose
  @verbose
end

Class Method Details

.from_slug(slug) ⇒ Object

Class init function with a “orta/project” style string



42
43
44
45
# File 'lib/gh_inspector/inspector.rb', line 42

def self.from_slug(slug)
  details = slug.split '/'
  Inspector.new details.first, details.last
end

Instance Method Details

#search_exception(exception, delegate = nil) ⇒ Object

Will do some magic to try and pull out a reasonable search query for an exception, then searches with that



57
58
59
60
# File 'lib/gh_inspector/inspector.rb', line 57

def search_exception(exception, delegate = nil)
  query = ExceptionHound.new(exception).query
  search_query(query, delegate)
end

#search_query(query, delegate = nil) ⇒ Object

Queries for an specific search string



63
64
65
66
# File 'lib/gh_inspector/inspector.rb', line 63

def search_query(query, delegate = nil)
  delegate ||= Evidence.new
  sidekick.search(query, delegate)
end