Sha256: 8b51c670bb19c39f170ca1192afe427d6cc62fd90ba38322c88f7d2548009d25

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 KB

Contents

require "metric_fu/constantize"
module MetricFu
  module Formatter
    BUILTIN_FORMATS = {
      "html" => ["MetricFu::Formatter::HTML", "Generates a templated HTML report using the configured template class and graph engine."],
      "yaml" => ["MetricFu::Formatter::YAML", "Generates the raw output as yaml"]
    }
    DEFAULT = [[:html]]

    class << self
      include MetricFu::Constantize

      def class_for(format)
        if (builtin = BUILTIN_FORMATS[format.to_s])
          constantize(builtin[0])
        else
          constantize(format.to_s)
        end
      end
    end

    module Templates
      MetricFu.lib_require { "templates/metrics_template" }

      module_function

      def templates_configuration=(templates_configuration)
        @templates_configuration = templates_configuration
      end

      def option(name)
        templates_configuration.option(name)
      end

      def templates_configuration
        @templates_configuration ||= MetricFu::Templates::Configuration.new
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
metric_fu-4.13.0 lib/metric_fu/formatter.rb
fastruby-metric_fu-5.0.0 lib/metric_fu/formatter.rb
code_metric_fu-4.14.4 lib/metric_fu/formatter.rb
code_metric_fu-4.14.3 lib/metric_fu/formatter.rb
code_metric_fu-4.14.2 lib/metric_fu/formatter.rb
code_metric_fu-4.14.1 lib/metric_fu/formatter.rb
code_metric_fu-4.14.0 lib/metric_fu/formatter.rb
metric_fu-4.12.0 lib/metric_fu/formatter.rb
metric_fu-4.11.4 lib/metric_fu/formatter.rb