Sha256: c4dbfc3a840b8363af8015dd41eb67e82a08ada4f9d3b099d922535a59b70755

Contents?: true

Size: 497 Bytes

Versions: 6

Compression:

Stored size: 497 Bytes

Contents

module BetterErrors
  # @private
  class CodeFormatter::HTML < CodeFormatter
    def source_unavailable
      "<p class='unavailable'>Source is not available</p>"
    end

    def formatted_lines
      each_line_of highlighted_lines do |highlight, current_line, str|
        class_name = highlight ? "highlight" : ""
        sprintf '<pre class="%s">%5d %s</pre>', class_name, current_line, str
      end
    end

    def formatted_code
      %{<div class="code">#{super}</div>}
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
better_errors-0.9.0 lib/better_errors/code_formatter/html.rb
better_errors-0.8.0 lib/better_errors/code_formatter/html.rb
better_errors-0.7.2 lib/better_errors/code_formatter/html.rb
better_errors-0.7.0 lib/better_errors/code_formatter/html.rb
better_errors-0.6.0 lib/better_errors/code_formatter/html.rb
better_errors-0.5.0 lib/better_errors/code_formatter/html.rb