Class: GrafanaReporter::ERB::Report
- Inherits:
-
AbstractReport
- Object
- AbstractReport
- GrafanaReporter::ERB::Report
- Defined in:
- lib/grafana_reporter/erb/report.rb
Overview
Implementation of a specific AbstractReport. It is used to build reports specifically for erb templates.
Constant Summary
Constants inherited from AbstractReport
AbstractReport::EVENT_CALLBACKS
Instance Attribute Summary
Attributes inherited from AbstractReport
#cancel, #done, #end_time, #logger, #start_time, #template
Class Method Summary collapse
- .default_result_extension ⇒ Object
- .default_template_extension ⇒ Object
- .demo_report_classes ⇒ Object
Instance Method Summary collapse
-
#build ⇒ Object
Starts to create an asciidoctor report.
Methods inherited from AbstractReport
add_event_listener, #cancel!, clear_event_listeners, #create_report, #delete_file, #error, #execution_time, #full_log, #grafana, #initialize, #next_step, #path, #progress, #status
Constructor Details
This class inherits a constructor from GrafanaReporter::AbstractReport
Class Method Details
.default_result_extension ⇒ Object
26 27 28 |
# File 'lib/grafana_reporter/erb/report.rb', line 26 def self.default_result_extension 'txt' end |
.default_template_extension ⇒ Object
21 22 23 |
# File 'lib/grafana_reporter/erb/report.rb', line 21 def self.default_template_extension 'erb' end |
.demo_report_classes ⇒ Object
31 32 33 |
# File 'lib/grafana_reporter/erb/report.rb', line 31 def self.demo_report_classes [DemoReportBuilder] end |
Instance Method Details
#build ⇒ Object
Starts to create an asciidoctor report. It utilizes all extensions in the Asciidoctor namespace to realize the conversion.
13 14 15 16 17 18 |
# File 'lib/grafana_reporter/erb/report.rb', line 13 def build attrs = @config.default_document_attributes.merge(@custom_attributes).merge({ 'grafana_report_timestamp' => ::Grafana::Variable.new(Time.now.to_s) }) logger.debug("Document attributes: #{attrs}") File.write(path, ::ERB.new(File.read(@template)).result(ReportJail.new(self, attrs).bind)) end |