Class: Reek::Report::SimpleWarningFormatter
- Inherits:
-
Object
- Object
- Reek::Report::SimpleWarningFormatter
- Defined in:
- lib/reek/report/simple_warning_formatter.rb
Overview
Basic formatter that just shows a simple message for each warning, prepended with the result of the passed-in location formatter.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#location_formatter ⇒ Object
readonly
private
Returns the value of attribute location_formatter.
Instance Method Summary collapse
- #format(warning) ⇒ Object
- #format_list(warnings) ⇒ Object
-
#initialize(location_formatter: BlankLocationFormatter) ⇒ SimpleWarningFormatter
constructor
A new instance of SimpleWarningFormatter.
Constructor Details
#initialize(location_formatter: BlankLocationFormatter) ⇒ SimpleWarningFormatter
Returns a new instance of SimpleWarningFormatter.
10 11 12 |
# File 'lib/reek/report/simple_warning_formatter.rb', line 10 def initialize(location_formatter: BlankLocationFormatter) @location_formatter = location_formatter end |
Instance Attribute Details
#location_formatter ⇒ Object (readonly, private)
Returns the value of attribute location_formatter.
24 25 26 |
# File 'lib/reek/report/simple_warning_formatter.rb', line 24 def location_formatter @location_formatter end |
Instance Method Details
#format(warning) ⇒ Object
14 15 16 |
# File 'lib/reek/report/simple_warning_formatter.rb', line 14 def format(warning) "#{location_formatter.format(warning)}#{warning.}" end |
#format_list(warnings) ⇒ Object
18 19 20 |
# File 'lib/reek/report/simple_warning_formatter.rb', line 18 def format_list(warnings) warnings.map { |warning| " #{format(warning)}" }.join("\n") end |