Class: RubyLint::Presenter::Syntastic

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby-lint/presenter/syntastic.rb

Overview

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

Constant Summary

FORMAT =

The format to use for each entry.

Returns:

'%{file}:%{level}:%{line}:%{column}: %{message}'

Instance Method Summary collapse

Methods inherited from Base

register

Constructor Details

#initialize(format = FORMAT.dup) ⇒ Syntastic

Returns a new instance of Syntastic

Parameters:

  • format (String) (defaults to: FORMAT.dup)


20
21
22
# File 'lib/ruby-lint/presenter/syntastic.rb', line 20

def initialize(format = FORMAT.dup)
  @format = format
end

Instance Method Details

#present(report) ⇒ String

Parameters:

Returns:



28
29
30
31
32
33
34
35
36
37
38
39
# 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