Sha256: c9a0fa391b9522ace291946475d1f3be866d21e615d5fc808b58c63c0f953105

Contents?: true

Size: 505 Bytes

Versions: 2

Compression:

Stored size: 505 Bytes

Contents

module Omnibar
  class Snippet < Query
    def result
      value = snippets[key]
      "#{key} :: #{value}" if (key and value)
    end

    def snippets
      Omnibar.config.snippets
    end

    def key
      search.find(input)
    end

    def relevance
      input.levenshtein_similar(key) if result
    end

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omnibar-0.0.8 lib/omnibar/queries/snippet.rb
omnibar-0.0.7 lib/omnibar/queries/snippet.rb