Class: Rucoa::HandlerConcerns::DiagnosticsPublishable::DiagnosticProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/rucoa/handler_concerns/diagnostics_publishable.rb

Defined Under Namespace

Classes: OffenseToDiagnosticMapper

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source:, uri:) ⇒ DiagnosticProvider

Returns a new instance of DiagnosticProvider.

Parameters:



56
57
58
59
60
61
62
# File 'lib/rucoa/handler_concerns/diagnostics_publishable.rb', line 56

def initialize(
  source:,
  uri:
)
  @source = source
  @uri = uri
end

Class Method Details

.call(source:, uri:) ⇒ Array<Hash>

Parameters:

Returns:

  • (Array<Hash>)


47
48
49
50
51
52
# File 'lib/rucoa/handler_concerns/diagnostics_publishable.rb', line 47

def self.call(source:, uri:)
  new(
    source: source,
    uri: uri
  ).call
end

Instance Method Details

#callArray<Hash>

Returns:

  • (Array<Hash>)


65
66
67
68
69
70
71
72
73
74
75
# File 'lib/rucoa/handler_concerns/diagnostics_publishable.rb', line 65

def call
  return [] unless Rubocop::ConfigurationChecker.call

  offenses.map do |offense|
    OffenseToDiagnosticMapper.call(
      offense,
      source: @source,
      uri: @uri
    )
  end
end