Class: Reviewer::Guidance
- Inherits:
-
Object
- Object
- Reviewer::Guidance
- Defined in:
- lib/reviewer/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.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(command:, result:, output: Reviewer.output) ⇒ 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:, output: Reviewer.output) ⇒ Guidance
Create an instance of guidance for suggesting recovery steps after errors
16 17 18 19 20 |
# File 'lib/reviewer/guidance.rb', line 16 def initialize(command:, result:, output: Reviewer.output) @command = command @result = result @output = output end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
8 9 10 |
# File 'lib/reviewer/guidance.rb', line 8 def command @command end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
8 9 10 |
# File 'lib/reviewer/guidance.rb', line 8 def output @output end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
8 9 10 |
# File 'lib/reviewer/guidance.rb', line 8 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
25 26 27 28 29 30 31 |
# File 'lib/reviewer/guidance.rb', line 25 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 |