Module: LinkableErrorsHandler
- Defined in:
- lib/rubymine_heaven/linkable_errors_handler.rb
Class Method Summary collapse
- .handle_part(path, line) ⇒ Object
- .handle_path(path) ⇒ Object
- .link_to_code(text) ⇒ Object
- .regexp ⇒ Object
Class Method Details
.handle_part(path, line) ⇒ Object
21 22 23 24 25 |
# File 'lib/rubymine_heaven/linkable_errors_handler.rb', line 21 def handle_part(path, line) href = File.join("/rodebug/start", path, line) anchor_text = "#{path}:#{line}" result = "<a href='http://localhost:3000#{href}'>#{anchor_text}</a>" end |
.handle_path(path) ⇒ Object
27 28 29 |
# File 'lib/rubymine_heaven/linkable_errors_handler.rb', line 27 def handle_path(path) path.gsub(%r{/}, "$").gsub(%r{^$}, "") end |
.link_to_code(text) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/rubymine_heaven/linkable_errors_handler.rb', line 8 def link_to_code(text) text.scan(regexp).each do |part| path = part[0] line = part[1] text.gsub! "#{path}:#{line}", handle_part(path, line) end text end |
.regexp ⇒ Object
17 18 19 |
# File 'lib/rubymine_heaven/linkable_errors_handler.rb', line 17 def regexp @regexp ||= %r{((?<path>/.*?\.rb)\:(?<line>\d+)\:in)} end |