Class: TodoLint::Reporter
- Inherits:
-
Object
- Object
- TodoLint::Reporter
- Defined in:
- lib/todo_lint/reporter.rb
Overview
We want to be able to report to users about the todos in their code, and the Reporter is responsible for passing judgment and generating output
Instance Method Summary collapse
-
#initialize(todo, judge: RequiredArg.new) ⇒ Reporter
constructor
Accept a todo and a path to check for problems.
-
#report ⇒ String, NilClass
Generate the output to show the user about their todo.
Constructor Details
#initialize(todo, judge: RequiredArg.new) ⇒ Reporter
Accept a todo and a path to check for problems
10 11 12 13 14 |
# File 'lib/todo_lint/reporter.rb', line 10 def initialize(todo, judge: RequiredArg.new) @todo = todo @path = todo.path @judge = judge end |
Instance Method Details
#report ⇒ String, NilClass
Generate the output to show the user about their todo
22 23 24 25 26 27 28 |
# File 'lib/todo_lint/reporter.rb', line 22 def report return if judge.charge.nil? "#{todo_location} #{problem}\n" \ "#{todo.line.chomp.lstrip}\n" \ "#{spaces}#{carets}" end |