Module: RoRailsHelpers::Handler
- Defined in:
- lib/ro_rails_helpers/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
22 23 24 25 26 |
# File 'lib/ro_rails_helpers/handler.rb', line 22 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
28 29 30 |
# File 'lib/ro_rails_helpers/handler.rb', line 28 def handle_path(path) path.gsub(%r{/}, "$").gsub(%r{^$}, "") end |
.link_to_code(text) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/ro_rails_helpers/handler.rb', line 9 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
18 19 20 |
# File 'lib/ro_rails_helpers/handler.rb', line 18 def regexp @regexp ||= %r{((?<path>/.*?\.rb)\:(?<line>\d+)\:in)} end |