Class: Simplabs::Excellent::Formatters::Base
- Inherits:
-
Object
- Object
- Simplabs::Excellent::Formatters::Base
- Defined in:
- lib/simplabs/excellent/formatters/base.rb
Overview
The base class for all formatters.
Instance Method Summary collapse
-
#end ⇒ Object
Called when the Simplabs::Excellent::Runner ends processing code.
-
#file(filename) ⇒ Object
Called whenever the Simplabs::Excellent::Runner processes a file.
-
#initialize(stream) ⇒ Base
constructor
Initializes the formatter.
-
#start ⇒ Object
Called when the Simplabs::Excellent::Runner starts processing code.
-
#warning(warning) ⇒ Object
Called when the Simplabs::Excellent::Runner found a warning.
Constructor Details
#initialize(stream) ⇒ Base
Initializes the formatter.
Always call super in custom formatters!
13 14 15 |
# File 'lib/simplabs/excellent/formatters/base.rb', line 13 def initialize(stream) @stream = stream end |
Instance Method Details
#end ⇒ Object
Called when the Simplabs::Excellent::Runner ends processing code.
The text formatter renders the footer here (‘Found <x> warnings’).
40 41 |
# File 'lib/simplabs/excellent/formatters/base.rb', line 40 def end end |
#file(filename) ⇒ Object
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
30 31 |
# File 'lib/simplabs/excellent/formatters/base.rb', line 30 def file(filename) end |
#start ⇒ Object
Called when the Simplabs::Excellent::Runner starts processing code.
The text formatter renders the heading here (‘Excellent result’)
20 21 |
# File 'lib/simplabs/excellent/formatters/base.rb', line 20 def start end |
#warning(warning) ⇒ Object
Called when the Simplabs::Excellent::Runner found a warning. This warning will always refer to the last filename, file was invoked with.
34 35 |
# File 'lib/simplabs/excellent/formatters/base.rb', line 34 def warning(warning) end |