class RubyLint::Presenter::Text

{RubyLint::Presenter::Text} formats a instance of {RubyLint::Report} into a text based, human readable format.

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/text.rb, line 21
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/text.rb, line 29
def present(report)
  entries = []

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

  return entries.join("\n")
end