Module: ErrorLocator

Defined in:
lib/error-locator.rb,
lib/error-locator/version.rb

Constant Summary collapse

VERSION =
"0.0.6"

Class Method Summary collapse

Class Method Details

.call(env) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/error-locator.rb', line 2

def self.call(env)
  req = Rack::Request.new(env)
  clicked_line = req.params['line']
  #location format: 'filename:linenumber'
  location = clicked_line[/[^:]+[:]\d+/]
  if !location.blank?
    location = File.expand_path(location)
    filename = location[/[^:]/]
    `$EDITOR "#{location}"` if File.exists?(filename)
  end
  [200, {}, [] ]
end