Module: Saddler::Reporter
- Defined in:
- lib/saddler/reporter.rb
Class Method Summary collapse
- .add_reporter(reporter_type, output = nil) ⇒ Object
-
.custom_reporter_class(specified_class_name) ⇒ Object
Copy from rubocop: lib/rubocop/formatter/formatter_set.rb.
Class Method Details
.add_reporter(reporter_type, output = nil) ⇒ Object
3 4 5 6 7 |
# File 'lib/saddler/reporter.rb', line 3 def self.add_reporter(reporter_type, output = nil) reporter = custom_reporter_class(reporter_type) output = $stdout unless output reporter.new(output) end |
.custom_reporter_class(specified_class_name) ⇒ Object
Copy from rubocop: lib/rubocop/formatter/formatter_set.rb
11 12 13 14 15 16 17 |
# File 'lib/saddler/reporter.rb', line 11 def self.custom_reporter_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 |