Class: Omnibar::Popular

Inherits:
Query
  • Object
show all
Defined in:
lib/omnibar/queries/popular.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

.searchObject



7
8
9
# File 'lib/omnibar/queries/popular.rb', line 7

def self.search
  @fm ||= FuzzyMatch.new(Omnibar.config.popular.sites)
end

Instance Method Details

#perform!Object



15
16
17
18
# File 'lib/omnibar/queries/popular.rb', line 15

def perform!
  return if input.match?(/^fac?e?b?o?o?k?/)
  open_in_browser "https://#{result}"
end

#relevanceObject



11
12
13
# File 'lib/omnibar/queries/popular.rb', line 11

def relevance
  input.levenshtein_similar(result) if result
end

#resultObject



3
4
5
# File 'lib/omnibar/queries/popular.rb', line 3

def result
  search.find(input)
end