Module: Docscribe::CLI::Formatters

Defined in:
lib/docscribe/cli/formatters.rb,
lib/docscribe/cli/formatters/json.rb,
lib/docscribe/cli/formatters/text.rb,
lib/docscribe/cli/formatters/sarif.rb

Overview

Factory for output formatters.

Defined Under Namespace

Classes: Json, Sarif, Text

Class Method Summary collapse

Class Method Details

.for(format) ⇒ Docscribe::CLI::Formatters::Text, ...

Select formatter by format type.

Parameters:

  • format (Docscribe::CLI::Formatters::format)

    output format symbol

Returns:

Raises:

  • (ArgumentError)


12
13
14
15
16
17
18
19
# File 'lib/docscribe/cli/formatters.rb', line 12

def self.for(format)
  case format
  when :text then Text.new
  when :json then Json.new
  when :sarif then Sarif.new
  else raise ArgumentError, "Unknown format: #{format}"
  end
end