Class: Omnibar::Snippet

Inherits:
Query
  • Object
show all
Defined in:
lib/omnibar/snippet.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, #open_in_browser, #preview_text

Constructor Details

This class inherits a constructor from Omnibar::Query

Class Method Details

.searchObject



13
14
15
# File 'lib/omnibar/snippet.rb', line 13

def self.search
  @fz ||= FuzzyMatch.new(Omnibar.config.snippets.keys)
end

Instance Method Details

#perform!Object



21
22
23
24
# File 'lib/omnibar/snippet.rb', line 21

def perform!
  key = search.find(input)
  copy_to_clipboard snippets[key]
end

#resultObject



3
4
5
6
7
# File 'lib/omnibar/snippet.rb', line 3

def result
  key = search.find(input)
  value = snippets[key]
  "#{key} :: #{value}" if (key and value)
end

#searchObject



17
18
19
# File 'lib/omnibar/snippet.rb', line 17

def search
  self.class.search
end

#snippetsObject



9
10
11
# File 'lib/omnibar/snippet.rb', line 9

def snippets
  Omnibar.config.snippets
end