Sha256: bc7866d0e49f84290106ad980f6cbfc369ca576765c1eeb0b9a5f8c23855a6ae

Contents?: true

Size: 691 Bytes

Versions: 6

Compression:

Stored size: 691 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,
      md: ::TraceLocation::Generator::Markdown,
      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

6 entries across 6 versions & 1 rubygems

Version Path
trace_location-0.12.2 lib/trace_location/report.rb
trace_location-0.12.1 lib/trace_location/report.rb
trace_location-0.12.0 lib/trace_location/report.rb
trace_location-0.11.0 lib/trace_location/report.rb
trace_location-0.10.0 lib/trace_location/report.rb
trace_location-0.9.6 lib/trace_location/report.rb