Sha256: bf064035c84b5cb215218d3c66fc2e4634c1276b3d30efd19a213e45c88d827a

Contents?: true

Size: 410 Bytes

Versions: 3

Compression:

Stored size: 410 Bytes

Contents

require 'clarity/renderers/log_renderer'

class MailFileLogRenderer < LogRenderer

  MailFilePath = %r{Processing mail (.+)/inbound/(.+)}

  def render(line = {})
    output = super(line)
    output.gsub!(MailFilePath) do |match|
      "Processing mail "+html_file_link("inbound/#{$2}")
    end
    output
  end

  private

  def html_file_link(path)
    "<a href='/fetch?path=#{path}'>#{path}</a>"
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bastard-0.0.4 lib/bastard/renderers/mail_file_log_renderer.rb
bastard-0.0.3 lib/bastard/renderers/mail_file_log_renderer.rb
bastard-0.0.1 lib/bastard/renderers/mail_file_log_renderer.rb