Class: Omnibar::Github
- Inherits:
-
Query
- Object
- Query
- Omnibar::Github
show all
- Defined in:
- lib/omnibar/queries/github.rb
Instance Attribute Summary
Attributes inherited from Query
#input
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Query
#copy_to_clipboard, inherited, #initialize, #label, #open_in_browser, #preview_text, #run_silently, #search
Constructor Details
This class inherits a constructor from Omnibar::Query
Class Method Details
.search ⇒ Object
9
10
11
|
# File 'lib/omnibar/queries/github.rb', line 9
def self.search
@fm ||= FuzzyMatch.new(Omnibar.config.github.repos)
end
|
Instance Method Details
13
14
15
16
|
# File 'lib/omnibar/queries/github.rb', line 13
def perform!
param = result.downcase.gsub(/\s/, '-')
open_in_browser "https://github.com/#{param}"
end
|
#relevance ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/omnibar/queries/github.rb', line 18
def relevance
if repo_full_name?
0.75
elsif result
input.levenshtein_similar(result)
end
end
|
#repo_full_name? ⇒ Boolean
26
27
28
|
# File 'lib/omnibar/queries/github.rb', line 26
def repo_full_name?
input.match?(/^[\w-]+\/[\w-]+$/)
end
|
#result ⇒ Object
3
4
5
6
7
|
# File 'lib/omnibar/queries/github.rb', line 3
def result
repo = search.find(input)
return repo if repo
return input if repo_full_name?
end
|