Class: Toothpick::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/toothpick/search.rb

Instance Method Summary collapse

Constructor Details

#initialize(picks_dir, string) ⇒ Search

Returns a new instance of Search.



4
5
6
7
8
9
10
11
12
# File 'lib/toothpick/search.rb', line 4

def initialize(picks_dir, string)
  # Works only with the_silver_searcher for now
  unless `cd #{picks_dir} && ag --version`.nil?
    space_separated_filenames = `ag -l #{string}`.split.join(' ')
    unless space_separated_filenames.empty?
      system("$EDITOR #{space_separated_filenames}")
    end
  end
end