Class: RuboCop::Cop::Metz::ControllerCollaboratorCollector
- Inherits:
-
Object
- Object
- RuboCop::Cop::Metz::ControllerCollaboratorCollector
- Defined in:
- lib/rubocop/cop/metz/controllers_too_many_direct_collaborators.rb
Constant Summary collapse
- CORE_COLLABORATOR_ALLOWLIST =
%w[ Rails Arel Time Date DateTime File FileUtils Pathname Hash Array String Integer Float Symbol Set SecureRandom JSON YAML URI CGI ERB ].freeze
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(method_node) ⇒ ControllerCollaboratorCollector
constructor
A new instance of ControllerCollaboratorCollector.
Constructor Details
#initialize(method_node) ⇒ ControllerCollaboratorCollector
Returns a new instance of ControllerCollaboratorCollector.
102 103 104 105 |
# File 'lib/rubocop/cop/metz/controllers_too_many_direct_collaborators.rb', line 102 def initialize(method_node) @method_node = method_node @same_class_constants = ControllerClassConstants.new(method_node).names end |
Instance Method Details
#call ⇒ Object
107 108 109 110 111 |
# File 'lib/rubocop/cop/metz/controllers_too_many_direct_collaborators.rb', line 107 def call method_node.each_descendant(:const).with_object({}) do |const_node, ordered| record(ordered, const_node) end end |