Sha256: a194685e9e3da6b17b45a402324d21c7212a8ec0ba4d2c67cac9190bb90315be

Contents?: true

Size: 968 Bytes

Versions: 25

Compression:

Stored size: 968 Bytes

Contents

module Footnotes
  module Extensions
    module Exception
      def self.included(base)
        base.class_eval do
          alias_method_chain :clean_backtrace, :links
        end
      end

      def add_links_to_backtrace(lines)
        lines.collect do |line|
          expanded = line.gsub('#{RAILS_ROOT}', RAILS_ROOT)
          if match = expanded.match(/^(.+):(\d+):in/) || match = expanded.match(/^(.+):(\d+)\s*$/)
            file = File.expand_path(match[1])
            line_number = match[2]
            html = %[<a href="#{Footnotes::Filter.prefix(file, line_number, 1)}">#{line}</a>]
          else
            line
          end
        end
      end

      def clean_backtrace_with_links
        unless ::Footnotes::Filter.prefix.blank?
          add_links_to_backtrace(clean_backtrace_without_links)
        else
          clean_backtrace_without_links
        end
      end
    end
  end
end

Exception.send :include, Footnotes::Extensions::Exception

Version data entries

25 entries across 25 versions & 8 rubygems

Version Path
artofmission-rails-footnotes-3.6.0.1 lib/rails-footnotes/backtracer.rb
artofmission-rails-footnotes-3.6.2 lib/rails-footnotes/backtracer.rb
ceritium-rails-footnotes-3.4.1.1 lib/rails-footnotes/backtracer.rb
ceritium-rails-footnotes-3.4.1 lib/rails-footnotes/backtracer.rb
ceritium-rails-footnotes-3.4 lib/rails-footnotes/backtracer.rb
josevalim-rails-footnotes-3.3.1 lib/backtracer.rb
josevalim-rails-footnotes-3.3.2 lib/backtracer/backtracer.rb
josevalim-rails-footnotes-3.4.1 lib/rails-footnotes/backtracer.rb
josevalim-rails-footnotes-3.4 lib/rails-footnotes/backtracer.rb
josevalim-rails-footnotes-3.5.0 lib/rails-footnotes/backtracer.rb
josevalim-rails-footnotes-3.6.0 lib/rails-footnotes/backtracer.rb
josevalim-rails-footnotes-3.6.1 lib/rails-footnotes/backtracer.rb
josevalim-rails-footnotes-3.6.2 lib/rails-footnotes/backtracer.rb
lexrupy-rails-footnotes-3.3.2 lib/rails-footnotes/backtracer.rb
lexrupy-rails-footnotes-3.4.1 lib/rails-footnotes/backtracer.rb
lexrupy-rails-footnotes-3.4 lib/rails-footnotes/backtracer.rb
omghax-rails-footnotes-3.6.1 lib/rails-footnotes/backtracer.rb
omghax-rails-footnotes-3.6.2 lib/rails-footnotes/backtracer.rb
rails-footnotes-3.6.7 lib/rails-footnotes/backtracer.rb
rails-footnotes-3.6.6 lib/rails-footnotes/backtracer.rb