Ameba::Formatter::ExplainFormatter - ameba 1.7.0

# class Ameba::Formatter::ExplainFormatter

- Ameba::Formatter::ExplainFormatter
- Reference
- Object

##
Overview

A formatter that shows the detailed explanation of the issue at a specific location.

##
Included Modules

- Ameba::Formatter::Util

##
Defined in:

ameba/formatter/explain_formatter.cr

##
Constructors

- .new(output : IO, location : Crystal::Location)

  Creates a new instance of `ExplainFormatter`.

##
Instance Method Summary

- #finished(sources) : Nil

  Reports the explanations at the @location.

- #location : Crystal::Location
- #output : IO::FileDescriptor | IO::Memory

### Instance methods inherited from module `Ameba::Formatter::Util`

affected_code(issue : Issue, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ")
affected_code(code, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ") affected_code, colorize_code_fences(string : String, color : Colorize::Color = :dark_gray) colorize_code_fences, colorize_markdown(string : String, code_color : Colorize::Color = :dark_gray) colorize_markdown, colorize_text_styles(string : String) colorize_text_styles, context(lines, lineno, context_lines = 3, remove_empty = true) context, deansify(message : String | Nil) : String | Nil deansify, pluralize(count : Int, singular : String, plural = "#{singular}s") pluralize, to_human(span : Time::Span) to_human, trim(str, max_length = 120, ellipsis = " ...") trim

##
Constructor Detail

def self.new(output : IO, location : Crystal::Location) #

Creates a new instance of `ExplainFormatter`.

Accepts output which indicates the `IO` where the explanation will be written to. Second argument is location which indicates the location to explain.

    ExplainFormatter.new output, {
      file:   path,
      line:   line_number,
      column: column_number,
    }

##
Instance Method Detail

def finished(sources) : Nil #

Reports the explanations at the @location.

def location : Crystal::Location #
def output : IO::FileDescriptor | IO::Memory #