Class: Chatwerk::Views::ViolationsDetailsView

Inherits:
BaseView
  • Object
show all
Defined in:
lib/chatwerk/views/violations_details_view.rb

Instance Attribute Summary

Attributes inherited from BaseView

#data, #output

Instance Method Summary collapse

Methods inherited from BaseView

#initialize, render, #render

Constructor Details

This class inherits a constructor from Chatwerk::Views::BaseView

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Chatwerk::Views::BaseView

Instance Method Details

#template(package:, violations:, constant_name:) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/chatwerk/views/violations_details_view.rb', line 6

def template(package:, violations:, constant_name:)
  relevant_violations = violations.anonymous_sources_with_locations.select { |c, _| c.start_with?(constant_name) }

  if relevant_violations.empty?
    Views::NoViolationsView.render(package:, constant_name:)
  else
    grep_formatted_violations(relevant_violations)
  end
end