Class: Kamal::Lint::Formatters::Json
- Inherits:
-
Object
- Object
- Kamal::Lint::Formatters::Json
- Defined in:
- lib/kamal/lint/formatters/json.rb
Instance Method Summary collapse
-
#initialize(io: $stdout) ⇒ Json
constructor
A new instance of Json.
- #render(result) ⇒ Object
Constructor Details
#initialize(io: $stdout) ⇒ Json
Returns a new instance of Json.
9 10 11 |
# File 'lib/kamal/lint/formatters/json.rb', line 9 def initialize(io: $stdout) @io = io end |
Instance Method Details
#render(result) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/kamal/lint/formatters/json.rb', line 13 def render(result) payload = { kamal_lint_version: Kamal::Lint::VERSION, kamal_version: result.context&.kamal_version, destinations: result.destinations, findings: result.findings.map(&:to_h), summary: { errors: result.errors.size, warnings: result.warnings.size, infos: result.infos.size } } @io.puts JSON.pretty_generate(payload) end |