Class: RuboCop::Capybara::ConfigFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/capybara/config_formatter.rb

Overview

Builds a YAML config file from two config hashes

Constant Summary collapse

EXTENSION_ROOT_DEPARTMENT =
%r{^(Capybara/)}.freeze
SUBDEPARTMENTS =
%(Capybara/RSpec)
AMENDMENTS =
[].freeze
COP_DOC_BASE_URL =
'https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/'

Instance Method Summary collapse

Constructor Details

#initialize(config, descriptions) ⇒ ConfigFormatter

Returns a new instance of ConfigFormatter.



14
15
16
17
# File 'lib/rubocop/capybara/config_formatter.rb', line 14

def initialize(config, descriptions)
  @config       = config
  @descriptions = descriptions
end

Instance Method Details

#dumpObject



19
20
21
22
23
24
25
# File 'lib/rubocop/capybara/config_formatter.rb', line 19

def dump
  YAML.dump(unified_config)
    .gsub(EXTENSION_ROOT_DEPARTMENT, "\n\\1")
    .gsub(/^(\s+)- /, '\1  - ')
    .gsub('"~"', '~')
  # .gsub(*AMENDMENTS, "\n\\0")
end