Sha256: cafa4d1e96e595ff0dce7ad43849887c6322f2a5533285985a13951e859310a7

Contents?: true

Size: 1.09 KB

Versions: 16

Compression:

Stored size: 1.09 KB

Contents

require "erb"
module Relevance::Tarantula::HtmlReportHelper 
  include ERB::Util
  include Relevance::Tarantula
  def wrap_in_line_number_table_row(text, &blk)
    x = Builder::XmlMarkup.new

    x.tr do
      lines = text.split("\n")
      x.td(:class => "numbers") do
        lines.size.times do |index|
          x.span(index+1, :class => "line number")
        end
      end
      x.td(:class => "lines") do
        lines.each do |line|
          x.span(line, :class => "line")
        end
      end
    end

    x.target!
  end 
                                                                            
  def textmate_url(file, line_no)
    "txmt://open?url=file://#{File.expand_path(File.join(rails_root,file))}&line_no=#{line_no}"
  end
  
  def wrap_stack_trace_line(text)
    if text =~ %r{^\s*(/[^:]+):(\d+):([^:]+)$}
      file = h($1) # .to_s_xss_protected
      line_number = $2
      message = h($3) # .to_s_xss_protected
      "<a href='#{textmate_url(file, line_number)}'>#{file}:#{line_number}</a>:#{message}" # .mark_as_xss_protected
    else
      h(text) # .to_s_xss_protected
    end
  end
end

Version data entries

16 entries across 16 versions & 5 rubygems

Version Path
relevance-tarantula-0.1.5 lib/relevance/tarantula/html_report_helper.rb
relevance-tarantula-0.1.6 lib/relevance/tarantula/html_report_helper.rb
relevance-tarantula-0.1.7 lib/relevance/tarantula/html_report_helper.rb
relevance-tarantula-0.1.8 lib/relevance/tarantula/html_report_helper.rb
relevance-tarantula-0.2.0 lib/relevance/tarantula/html_report_helper.rb
relevance-tarantula-0.2.1 lib/relevance/tarantula/html_report_helper.rb
relevance-tarantula-0.3.2 lib/relevance/tarantula/html_report_helper.rb
relevance-tarantula-0.3.3 lib/relevance/tarantula/html_report_helper.rb
romanbsd-tarantula-0.1.8 lib/relevance/tarantula/html_report_helper.rb
romanbsd-tarantula-0.2.0 lib/relevance/tarantula/html_report_helper.rb
tarantula-rails3-0.3.3 lib/relevance/tarantula/html_report_helper.rb
panmind-tarantula-0.3.3 lib/relevance/tarantula/html_report_helper.rb
tarantula-0.3.3 lib/relevance/tarantula/html_report_helper.rb
tarantula-0.1.8 lib/relevance/tarantula/html_report_helper.rb
tarantula-0.2.0 lib/relevance/tarantula/html_report_helper.rb
tarantula-0.1.5 lib/relevance/tarantula/html_report_helper.rb