Module: RuboCop::Cop::Documentation
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/rubocop/cop/documentation.rb |
Overview
Helpers for builtin documentation
Class Method Summary
- .base_url_for(cop_class, config) Internal use only mod_func Internal use only
- .default_base_url Internal use only mod_func Internal use only
- .department_to_basename(department) Internal use only mod_func Internal use only
- .url_for(cop_class, config = nil) Internal use only mod_func Internal use only
Class Method Details
.base_url_for(cop_class, config) (mod_func)
This method is for internal use only.
[ GitHub ]
# File 'lib/rubocop/cop/documentation.rb', line 24
def base_url_for(cop_class, config) return default_base_url unless config department_name = cop_class.department.to_s config.for_department(department_name)['DocumentationBaseURL'] || config.for_all_cops['DocumentationBaseURL'] end
.default_base_url (mod_func)
This method is for internal use only.
[ GitHub ]
# File 'lib/rubocop/cop/documentation.rb', line 34
def default_base_url 'https://docs.rubocop.org/rubocop' end
.department_to_basename(department) (mod_func)
This method is for internal use only.
[ GitHub ]
# File 'lib/rubocop/cop/documentation.rb', line 10
def department_to_basename(department) "cops_#{department.to_s.downcase.tr('/', '_')}" end
.url_for(cop_class, config = nil) (mod_func)
This method is for internal use only.
[ GitHub ]
# File 'lib/rubocop/cop/documentation.rb', line 15
def url_for(cop_class, config = nil) base = department_to_basename(cop_class.department) fragment = cop_class.cop_name.downcase.gsub(/[^a-z]/, '') base_url = base_url_for(cop_class, config) "#{base_url}/#{base}.html##{fragment}" end