Sha256: e9cd44c0472a25bb46b1e965eb0c581a14208c1ac1fe72c918c596376e441226

Contents?: true

Size: 687 Bytes

Versions: 6

Compression:

Stored size: 687 Bytes

Contents

# -*- coding: utf-8 -*-

require 'erb'

module TurnipFormatter
  class Template
    module StepException
      def self.build(exception)
        template_step_exception.result(binding)
      end

    private

      def self.template_step_exception
        @template_step_exception ||= ERB.new(<<-EOS)
          <div class="step_exception">
            <span>Failure:</span>
            <pre><%= ERB::Util.h(exception.to_s) %></pre>
            <span>Backtrace:</span>
            <ol>
              <% exception.backtrace.each do |line| %>
              <li><%= ERB::Util.h(line) %></li>
              <% end %>
            </ol>
          </div>
        EOS
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
turnip_formatter-0.1.2 lib/turnip_formatter/template/step_exception.rb
turnip_formatter-0.1.1 lib/turnip_formatter/template/step_exception.rb
turnip_formatter-0.1.0 lib/turnip_formatter/template/step_exception.rb
turnip_formatter-0.0.6 lib/turnip_formatter/template/step_exception.rb
turnip_formatter-0.0.5 lib/turnip_formatter/template/step_exception.rb
turnip_formatter-0.0.4 lib/turnip_formatter/template/step_exception.rb