Class: Steep::Drivers::DiagnosticPrinter
- Defined in:
- lib/steep/drivers/diagnostic_printer.rb,
lib/steep/drivers/diagnostic_printer/base_formatter.rb,
lib/steep/drivers/diagnostic_printer/code_formatter.rb,
lib/steep/drivers/diagnostic_printer/github_actions_formatter.rb
Defined Under Namespace
Classes: BaseFormatter, CodeFormatter, GitHubActionsFormatter
Constant Summary collapse
- LSP =
LanguageServer::Protocol
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
-
#initialize(stdout:, buffer:, formatter: 'code') ⇒ DiagnosticPrinter
constructor
A new instance of DiagnosticPrinter.
- #print(diagnostic, prefix: "", source: true) ⇒ Object
Constructor Details
#initialize(stdout:, buffer:, formatter: 'code') ⇒ DiagnosticPrinter
Returns a new instance of DiagnosticPrinter.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/steep/drivers/diagnostic_printer.rb', line 10 def initialize(stdout:, buffer:, formatter: 'code') @stdout = stdout @buffer = buffer @formatter = case formatter when 'code' CodeFormatter.new(stdout: stdout, buffer: buffer) when 'github' GitHubActionsFormatter.new(stdout: stdout, buffer: buffer) else raise "Unknown formatter: #{formatter}" end end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
8 9 10 |
# File 'lib/steep/drivers/diagnostic_printer.rb', line 8 def buffer @buffer end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
7 8 9 |
# File 'lib/steep/drivers/diagnostic_printer.rb', line 7 def stdout @stdout end |
Instance Method Details
#print(diagnostic, prefix: "", source: true) ⇒ Object
23 24 25 |
# File 'lib/steep/drivers/diagnostic_printer.rb', line 23 def print(diagnostic, prefix: "", source: true) @formatter.print(diagnostic, prefix: prefix, source: source) end |