Class: ERBLint::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/erb_lint/reporter.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stats, autocorrect, show_linter_names = false) ⇒ Reporter

Returns a new instance of Reporter.



26
27
28
29
30
# File 'lib/erb_lint/reporter.rb', line 26

def initialize(stats, autocorrect, show_linter_names = false)
  @stats = stats
  @autocorrect = autocorrect
  @show_linter_names = show_linter_names
end

Class Method Details

.available_format?(format) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/erb_lint/reporter.rb', line 13

def self.available_format?(format)
  available_formats.include?(format.to_s)
end

.available_formatsObject



17
18
19
20
21
22
23
24
# File 'lib/erb_lint/reporter.rb', line 17

def self.available_formats
  descendants
    .map(&:to_s)
    .map(&:demodulize)
    .map(&:underscore)
    .map { |klass_name| klass_name.sub("_reporter", "") }
    .sort
end

.create_reporter(format, *args) ⇒ Object



8
9
10
11
# File 'lib/erb_lint/reporter.rb', line 8

def self.create_reporter(format, *args)
  reporter_klass = "#{ERBLint::Reporters}::#{format.to_s.camelize}Reporter".constantize
  reporter_klass.new(*args)
end

Instance Method Details

#previewObject



32
# File 'lib/erb_lint/reporter.rb', line 32

def preview; end

#showObject



34
# File 'lib/erb_lint/reporter.rb', line 34

def show; end