Module: Adhoq::Reporter
- Defined in:
- lib/adhoq/reporter.rb,
lib/adhoq/reporter/csv.rb,
lib/adhoq/reporter/json.rb,
lib/adhoq/reporter/xlsx.rb
Defined Under Namespace
Classes: Csv, Json, UnsupportedFormat, Xlsx
Class Method Summary
collapse
Class Method Details
.generate(execution) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/adhoq/reporter.rb', line 10
def generate(execution)
executor = Executor.new(execution.raw_sql)
reporter = lookup(execution.report_format).new(executor.execute)
reporter.build_report
end
|
.lookup(format) ⇒ Object
17
18
19
|
# File 'lib/adhoq/reporter.rb', line 17
def lookup(format)
reporters[format.to_s] || raise(UnsupportedFormat)
end
|
21
22
23
|
# File 'lib/adhoq/reporter.rb', line 21
def supported_formats
reporters.keys.sort
end
|