Class: DruidClient::CLi::OutputFormatFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/druid_client/cli/output_format_factory.rb

Constant Summary collapse

FORMATS =
{
  table: TableFormat,
  json: JsonFormat,
}.freeze

Class Method Summary collapse

Class Method Details

.create(format_name) ⇒ Object



15
16
17
18
19
# File 'lib/druid_client/cli/output_format_factory.rb', line 15

def self.create(format_name)
  format_class = FORMATS[format_name.to_sym]
  raise "Unknown format: #{format_name}" unless format_class
  format_class.new
end