Sha256: 2b94aaef9313f43ba801ae9af7d0f84d115d720ab5b1bc9a6b897ec825fcf51e
Contents?: true
Size: 735 Bytes
Versions: 11
Compression:
Stored size: 735 Bytes
Contents
require 'yaml' module RuboCop module RSpec # Builds a YAML config file from two config hashes class ConfigFormatter NAMESPACE = 'RSpec'.freeze def initialize(config, descriptions) @config = config @descriptions = descriptions end def dump YAML.dump(unified_config).gsub(/^#{NAMESPACE}/, "\n#{NAMESPACE}") end private def unified_config cops.each_with_object(config.dup) do |cop, unified| unified[cop] = config.fetch(cop).merge(descriptions.fetch(cop)) end end def cops (descriptions.keys + config.keys).uniq.grep(/\A#{NAMESPACE}/) end attr_reader :config, :descriptions end end end
Version data entries
11 entries across 11 versions & 1 rubygems