class Simplabs::Excellent::Formatters::Base

The base class for all formatters.

Public Class Methods

new(stream) click to toggle source

Initializes the formatter.

Always call super in custom formatters!

# File lib/simplabs/excellent/formatters/base.rb, line 13
def initialize(stream)
  @stream = stream
end

Public Instance Methods

end() click to toggle source

Called when the Simplabs::Excellent::Runner ends processing code.

The text formatter renders the footer here (‘Found <x> warnings’).

# File lib/simplabs/excellent/formatters/base.rb, line 40
def end
end
file(filename) click to toggle source

Called whenever the Simplabs::Excellent::Runner processes a file. Yields the formatter

You have to yield self in custom formatters. file is called like that by the runner:

formatter.file(filename) do |formatter|
  warnings.each { |warning| formatter.warning(warning) }
end
# File lib/simplabs/excellent/formatters/base.rb, line 30
def file(filename)
end
start() click to toggle source

Called when the Simplabs::Excellent::Runner starts processing code.

The text formatter renders the heading here (‘Excellent result’)

# File lib/simplabs/excellent/formatters/base.rb, line 20
def start
end
warning(warning) click to toggle source

Called when the Simplabs::Excellent::Runner found a warning. This warning will always refer to the last filename, file was invoked with.

# File lib/simplabs/excellent/formatters/base.rb, line 34
def warning(warning)
end