Parent

Files

Class/Module Index [+]

Quicksearch

RuboCop::Formatter::FormatterSet

This is a collection of formatters. A FormatterSet can hold multiple formatter instances and provides transparent formatter API methods which invoke same method of each formatters.

Public Instance Methods

add_formatter(formatter_type, output_path = nil) click to toggle source
# File lib/rubocop/formatter/formatter_set.rb, line 28
def add_formatter(formatter_type, output_path = nil)
  formatter_class = case formatter_type
                    when Class
                      formatter_type
                    when /\A[A-Z]/
                      custom_formatter_class(formatter_type)
                    else
                      builtin_formatter_class(formatter_type)
                    end

  output = output_path ? File.open(output_path, 'w') : $stdout

  self << formatter_class.new(output)
end
close_output_files() click to toggle source
# File lib/rubocop/formatter/formatter_set.rb, line 43
def close_output_files
  each do |formatter|
    formatter.output.close if formatter.output.is_a?(File)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.