Class: CopsDocumentationGenerator Private
- Inherits:
-
Object
- Object
- CopsDocumentationGenerator
- Includes:
- RuboCop::Cop::Documentation
- Defined in:
- lib/rubocop/cops_documentation_generator.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class for generating documentation of all cops departments
Instance Method Summary collapse
- #call ⇒ Object private
-
#initialize(departments: []) ⇒ CopsDocumentationGenerator
constructor
private
This class will only generate documentation for cops that belong to one of the departments given in the ‘departments` array.
Methods included from RuboCop::Cop::Documentation
department_to_basename, url_for
Constructor Details
#initialize(departments: []) ⇒ CopsDocumentationGenerator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This class will only generate documentation for cops that belong to one of the departments given in the ‘departments` array. E.g. if we only wanted documentation for Lint cops:
CopsDocumentationGenerator.new(departments: ['Lint']).call
13 14 15 16 17 |
# File 'lib/rubocop/cops_documentation_generator.rb', line 13 def initialize(departments: []) @departments = departments.map(&:to_sym).sort! @cops = RuboCop::Cop::Registry.global @config = RuboCop::ConfigLoader.default_configuration end |
Instance Method Details
#call ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rubocop/cops_documentation_generator.rb', line 19 def call YARD::Registry.load! departments.each do |department| print_cops_of_department(department) end print_table_of_contents ensure RuboCop::ConfigLoader.default_configuration = nil end |