Sha256: cf7239e5cec097585ded27ee9d6dd58386eeeae3e1b367ba08d3dc18d0fb15e3

Contents?: true

Size: 577 Bytes

Versions: 4

Compression:

Stored size: 577 Bytes

Contents

module CompareLinkerWrapper
  module Formatter
    def self.add_formatter(formatter_type, _output = nil)
      formatter = custom_formatter_class(formatter_type)
      formatter.new
    end

    # Copy from rubocop:
    # lib/rubocop/formatter/formatter_set.rb
    def self.custom_formatter_class(specified_class_name)
      constant_names = specified_class_name.split('::')
      constant_names.shift if constant_names.first.empty?
      constant_names.reduce(Object) do |namespace, constant_name|
        namespace.const_get(constant_name, false)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
compare_linker_wrapper-1.0.2 lib/compare_linker_wrapper/formatter.rb
compare_linker_wrapper-1.0.1 lib/compare_linker_wrapper/formatter.rb
compare_linker_wrapper-1.0.0 lib/compare_linker_wrapper/formatter.rb
compare_linker_wrapper-0.1.0 lib/compare_linker_wrapper/formatter.rb