Top Level Namespace

Defined Under Namespace

Modules: Quarry Classes: Assertion, Method, Module, Object

Instance Method Summary collapse

Instance Method Details

#breakout(error) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/quarry/breakout.rb', line 3

def breakout( error )

  file, line = *error.exception.backtrace[0].split(':')
  line = line.to_i

  puts error

  e = "# DEBUG " + error.to_s
  e.gsub!("`","'")

  e = Regexp.escape(e)

  case ed = ENV['EDITOR']
  when 'vi', 'vim', 'gvim'
    cmd = %[
      |#{ed} -e -s #{file} <<-EOS
      |:#{line}
      |a
      |#{e}
      |.
      |:.,+#{e.size}
      |EOS
      ].margin
  else
    puts "EDITOR environment variable not set"
  end

  system cmd

end