Sha256: 8dba506599ba16aecd315f714a61231ed8976e06dba60ad3aab3e73d8ab06382

Contents?: true

Size: 388 Bytes

Versions: 1

Compression:

Stored size: 388 Bytes

Contents

module Noty
  module Services
    module_function

    def search(keyword)
      files = `ag -l "#{keyword}" #{STORAGE_PATH}`.lines
      top_matches = files[0...9].map(&:chomp)
      top_matches.map do |file|
        case File.extname(file)
        when '.bookmark'
          Bookmark.new(file)
        when '.snippet'
          Snippet.new(file)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
noty-0.1.1 lib/noty/services/search.rb