class RSpec::Core::Formatters::TextMateFormatter
Formats backtraces so they're clickable by TextMate
Public Class Methods
new(output)
click to toggle source
Calls superclass method
RSpec::Core::Formatters::HtmlFormatter.new
# File lib/rspec/core/formatters/text_mate_formatter.rb, line 16 def initialize(output) super @printer = NonEscapingHtmlPrinter.new(output) end
Public Instance Methods
backtrace_line(line, skip_textmate_conversion=false)
click to toggle source
Calls superclass method
# File lib/rspec/core/formatters/text_mate_formatter.rb, line 21 def backtrace_line(line, skip_textmate_conversion=false) if skip_textmate_conversion super(line) else format_backtrace_line_for_textmate(super(line)) end end
extra_failure_content(exception)
click to toggle source
# File lib/rspec/core/formatters/text_mate_formatter.rb, line 36 def extra_failure_content(exception) require 'rspec/core/formatters/snippet_extractor' backtrace = exception.backtrace.map {|line| backtrace_line(line, :skip_textmate_conversion)} backtrace.compact! @snippet_extractor ||= SnippetExtractor.new " <pre class=\"ruby\"><code>#{@snippet_extractor.snippet(backtrace)}</code></pre>" end
format_backtrace_line_for_textmate(line)
click to toggle source
# File lib/rspec/core/formatters/text_mate_formatter.rb, line 29 def format_backtrace_line_for_textmate(line) return nil unless line CGI.escapeHTML(line).sub(/([^:]*\.e?rb):(\d*)/) do "<a href=\"txmt://open?url=file://#{File.expand_path($1)}&line=#{$2}\">#{$1}:#{$2}</a> " end end