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
base_url_for, default_base_url, 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
15 16 17 18 19 20 21 |
# File 'lib/rubocop/cops_documentation_generator.rb', line 15 def initialize(departments: []) @departments = departments.map(&:to_sym).sort! @cops = RuboCop::Cop::Registry.global @config = RuboCop::ConfigLoader.default_configuration @docs_path = "#{Dir.pwd}/docs/modules/ROOT/pages/" FileUtils.mkdir_p(@docs_path) 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.
23 24 25 26 27 28 29 30 |
# File 'lib/rubocop/cops_documentation_generator.rb', line 23 def call YARD::Registry.load! departments.each { |department| print_cops_of_department(department) } print_table_of_contents ensure RuboCop::ConfigLoader.default_configuration = nil end |