class RubyLint::Presenter::Emacs

{RubyLint::Presenter::Emacs} formats a instance of {RubyLint::Report} into a format parsable by Emacs compile mode

Constants

FORMAT

The default format to use when presenting report entries.

@return [String]

Public Class Methods

new(format = FORMAT.dup) click to toggle source

@param [String] format The format to use for each entry.

# File lib/ruby-lint/presenter/emacs.rb, line 20
def initialize(format = FORMAT.dup)
  @format = format
end

Public Instance Methods

present(report) click to toggle source

@param [RubyLint::Report] report The report to present. @return [String]

# File lib/ruby-lint/presenter/emacs.rb, line 28
def present(report)
  entries = []

  report.entries.sort.each do |entry|
    entries << @format % entry.attributes
  end

  return entries.join("\n")
end