Sha256: 2901864ce5c77b0f4088134cb0ccf868b659882a52daef5917ae1cb380ccca63

Contents?: true

Size: 643 Bytes

Versions: 7

Compression:

Stored size: 643 Bytes

Contents

# frozen_string_literal: true

module TraceLocation
  module Report # :nodoc:
    require_relative 'generator'

    class InvalidFormatError < ArgumentError; end

    GENERATORS = {
      csv: ::TraceLocation::Generator::Csv,
      log: ::TraceLocation::Generator::Log,
      markdown: ::TraceLocation::Generator::Markdown
    }.freeze

    def self.build(events, return_value, options)
      resolve_generator(options[:format]).new(events, return_value, options)
    end

    def self.resolve_generator(format)
      format ||= TraceLocation.config.default_format
      GENERATORS.fetch(format) { raise InvalidFormatError }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
trace_location-0.9.5 lib/trace_location/report.rb
trace_location-0.9.4 lib/trace_location/report.rb
trace_location-0.9.3.1 lib/trace_location/report.rb
trace_location-0.9.3 lib/trace_location/report.rb
trace_location-0.9.2 lib/trace_location/report.rb
trace_location-0.9.1 lib/trace_location/report.rb
trace_location-0.9.0 lib/trace_location/report.rb