class RubyLint::Presenter::Syntastic

Presenter that formats output that can be easily used in Syntastic plugins.

Constants

FORMAT

The format to use for each entry.

@return [String]

Public Class Methods

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

@param [String] format

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

Public Instance Methods

present(report) click to toggle source

@param [RubyLint::Report] report @return [String]

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

  report.entries.sort.each do |entry|
    attributes         = entry.attributes
    attributes[:level] = attributes[:level][0].upcase

    entries << @format % attributes
  end

  return entries.join("\n")
end