class GrafanaReporter::ERB::Report

Implementation of a specific {AbstractReport}. It is used to build reports specifically for erb templates.

Public Class Methods

default_result_extension() click to toggle source

@see AbstractReport#default_result_extension

# File lib/grafana_reporter/erb/report.rb, line 26
def self.default_result_extension
  'txt'
end
default_template_extension() click to toggle source

@see AbstractReport#default_template_extension

# File lib/grafana_reporter/erb/report.rb, line 21
def self.default_template_extension
  'erb'
end
demo_report_classes() click to toggle source

@see AbstractReport#demo_report_classes

# File lib/grafana_reporter/erb/report.rb, line 31
def self.demo_report_classes
  [DemoReportBuilder]
end

Public Instance Methods

build() click to toggle source

Starts to create an asciidoctor report. It utilizes all extensions in the {GrafanaReporter::Asciidoctor} namespace to realize the conversion. @see AbstractReport#build

# 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