class GrafanaReporter::AbstractTableFormatStrategy

The abstract base class, which is to be implemented for different table output formats. By implementing this class, you e.g. can decide if a table will be formatted as CSV, JSON or any other format.

Public Class Methods

abbreviation() click to toggle source

@abstract @return [String] short name of the current stategy, under which it shall be accessible

# File lib/grafana_reporter/abstract_table_format_strategy.rb, line 22
def self.abbreviation
  raise NotImplementedError
end
get(abbreviation) click to toggle source

@param abbreviation [String] name of the requested table format strategy @return [AbstractTableFormatStrategy] fitting strategy instance for the given name

# File lib/grafana_reporter/abstract_table_format_strategy.rb, line 16
def self.get(abbreviation)
  @@subclasses.select { |item| item.abbreviation == abbreviation }.first.new
end
inherited(obj) click to toggle source
# File lib/grafana_reporter/abstract_table_format_strategy.rb, line 10
def self.inherited(obj)
  @@subclasses << obj
end

Public Instance Methods

format(content, include_headline) click to toggle source

@abstract @param column [Array] datasource table result @param include_headline [Boolean] true, if headline should be included in result @return [String] formatted in table format

# File lib/grafana_reporter/abstract_table_format_strategy.rb, line 30
def format(content, include_headline)
  raise NotImplementedError
end