Module: CompareLinkerWrapper::Formatter

Defined in:
lib/compare_linker_wrapper/formatter.rb

Class Method Summary collapse

Class Method Details

.add_formatter(formatter_type, _output = nil) ⇒ Object



3
4
5
6
# File 'lib/compare_linker_wrapper/formatter.rb', line 3

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

.custom_formatter_class(specified_class_name) ⇒ Object

Copy from rubocop: lib/rubocop/formatter/formatter_set.rb



10
11
12
13
14
15
16
# File 'lib/compare_linker_wrapper/formatter.rb', line 10

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