Module: GrafanaReporter::Asciidoctor::ProcessorMixin
- Included in:
- AlertsTableIncludeProcessor, AnnotationsTableIncludeProcessor, PanelImageBlockMacro, PanelImageInlineMacro, PanelPropertyInlineMacro, PanelQueryTableIncludeProcessor, PanelQueryValueInlineMacro, ShowEnvironmentIncludeProcessor, ShowHelpIncludeProcessor, SqlTableIncludeProcessor, SqlValueInlineMacro, ValueAsVariableIncludeProcessor
- Defined in:
- lib/grafana_reporter/asciidoctor/processor_mixin.rb
Overview
This module contains common methods for all asciidoctor extensions.
Instance Method Summary collapse
-
#build_attribute_hash(document_hash, item_hash) ⇒ Hash
Merges the given hashes to a common attribute Hash.
-
#build_demo_entry(panel) ⇒ String
This method is called if a demo report shall be built for the given Grafana::Panel.
-
#current_report(report) ⇒ ::Asciidoctor::Extensions::Processor
Used when initializing a object instance, to set the report object, which is currently in progress.
Instance Method Details
#build_attribute_hash(document_hash, item_hash) ⇒ Hash
Merges the given hashes to a common attribute Hash. It respects the priorities of the hashes and the object and allows only valid variables to be used.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/grafana_reporter/asciidoctor/processor_mixin.rb', line 27 def build_attribute_hash(document_hash, item_hash) result = {} result['grafana_report_timestamp'] = document_hash['localdatetime'] result.merge!(document_hash.select do |k, _v| k =~ /^var-/ || k =~ /^(?:from|to)$/ || k =~ /^grafana_default_(?:from_timezone|to_timezone|timeout)$/ end) result.merge!(item_hash.select do |k, _v| # TODO: specify accepted options for each processor class individually k.to_s =~ /^(?:var-|render-)/ || k.to_s =~ /^(?:timeout|from|to)$/ || k.to_s =~ /filter_columns|format|replace_values_.*|transpose|from_timezone| to_timezone|result_type|query|table_formatter|include_headline| column_divider|row_divider|instant|interval|verbose_log|select_value| after_fetch|after_calculate/x end) result end |
#build_demo_entry(panel) ⇒ String
This method is called if a demo report shall be built for the given Grafana::Panel.
18 19 20 |
# File 'lib/grafana_reporter/asciidoctor/processor_mixin.rb', line 18 def build_demo_entry(panel) raise NotImplementedError end |
#current_report(report) ⇒ ::Asciidoctor::Extensions::Processor
Used when initializing a object instance, to set the report object, which is currently in progress.
10 11 12 13 |
# File 'lib/grafana_reporter/asciidoctor/processor_mixin.rb', line 10 def current_report(report) @report = report self end |