Class: Attractor::ConsoleReporter
- Inherits:
-
BaseReporter
- Object
- BaseReporter
- Attractor::ConsoleReporter
- Defined in:
- lib/attractor/reporters/console_reporter.rb
Overview
console reporter
Defined Under Namespace
Classes: CSVFormatter, JSONFormatter, TableFormatter
Instance Attribute Summary
Attributes inherited from BaseReporter
Instance Method Summary collapse
-
#initialize(format:, **other) ⇒ ConsoleReporter
constructor
A new instance of ConsoleReporter.
- #report ⇒ Object
Methods inherited from BaseReporter
Constructor Details
#initialize(format:, **other) ⇒ ConsoleReporter
Returns a new instance of ConsoleReporter.
79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/attractor/reporters/console_reporter.rb', line 79 def initialize(format:, **other) super(**other) @formatter = case format.to_sym when :csv CSVFormatter.new when :json JSONFormatter.new else TableFormatter.new end end |
Instance Method Details
#report ⇒ Object
91 92 93 94 |
# File 'lib/attractor/reporters/console_reporter.rb', line 91 def report super @formatter.call(@calculators) end |