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

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(offense, source:, uri:) ⇒ OffenseToDiagnosticMapper

Returns a new instance of OffenseToDiagnosticMapper.

Parameters:

  • offense (RuboCop::Cop::Offense)
  • source (Rucoa::Source)
  • uri (String)


124
125
126
127
128
129
130
131
132
# File 'lib/rucoa/handler_concerns/diagnostics_publishable.rb', line 124

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

Class Method Details

.call(offense, source:, uri:) ⇒ Hash

Parameters:

  • offense (RuboCop::Cop::Offense)
  • source (Rucoa::Source)
  • uri (String)

Returns:

  • (Hash)


108
109
110
111
112
113
114
115
116
117
118
# File 'lib/rucoa/handler_concerns/diagnostics_publishable.rb', line 108

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

Instance Method Details

#callHash

Returns:

  • (Hash)


135
136
137
138
139
140
141
142
143
144
# File 'lib/rucoa/handler_concerns/diagnostics_publishable.rb', line 135

def call
  {
    code: code,
    data: data,
    message: message,
    range: range,
    severity: severity,
    source: source
  }
end