Class: Output::Textmate

Inherits:
Object
  • Object
show all
Defined in:
lib/output/textmate.rb

Instance Method Summary collapse

Constructor Details

#initialize(grepmate) ⇒ Textmate

Returns a new instance of Textmate.



3
4
5
# File 'lib/output/textmate.rb', line 3

def initialize(grepmate)
  @grepmate = grepmate
end

Instance Method Details

#processObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/output/textmate.rb', line 7

def process
  print "Found #{@grepmate.results.size} matches.  "
  if @grepmate.results.size > 20
    puts  "Display? [Y/n]..."
    exit if $stdin.gets.chomp.downcase == 'n'
  else
    puts ''
  end

  @grepmate.results.each { |f|
    file, line = f.split(':')
    system("mate #{'-w ' if @grepmate.params['wait'].value}-l #{line} #{file}")
  }
end