Class: Reviewer::Runner::Guidance
- Inherits:
-
Object
- Object
- Reviewer::Runner::Guidance
- Defined in:
- lib/reviewer/runner/guidance.rb
Overview
Handles the logic around what to display after a command has been run
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#formatter ⇒ Object
readonly
Returns the value of attribute formatter.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(command:, result:, context:) ⇒ Guidance
constructor
Create an instance of guidance for suggesting recovery steps after errors.
-
#show ⇒ void
Prints the relevant guidance based on the command and result context.
Constructor Details
#initialize(command:, result:, context:) ⇒ Guidance
Create an instance of guidance for suggesting recovery steps after errors
16 17 18 19 20 21 |
# File 'lib/reviewer/runner/guidance.rb', line 16 def initialize(command:, result:, context:) @command = command @result = result @context = context @formatter = Runner::Formatter.new(context.output) end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
7 8 9 |
# File 'lib/reviewer/runner/guidance.rb', line 7 def command @command end |
#formatter ⇒ Object (readonly)
Returns the value of attribute formatter.
7 8 9 |
# File 'lib/reviewer/runner/guidance.rb', line 7 def formatter @formatter end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
7 8 9 |
# File 'lib/reviewer/runner/guidance.rb', line 7 def result @result end |
Instance Method Details
#show ⇒ void
This method returns an undefined value.
Prints the relevant guidance based on the command and result context
26 27 28 29 30 31 32 |
# File 'lib/reviewer/runner/guidance.rb', line 26 def show case result when executable_not_found? then show_missing_executable_guidance when cannot_execute? then show_unrecoverable_guidance else show_syntax_guidance end end |