Class: FootballCli::Format::FormatFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/football_cli/format/format_factory.rb

Class Method Summary collapse

Class Method Details

.build(format, *args) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/football_cli/format/format_factory.rb', line 8

def self.build(format, *args)
  case format
  when 'table' then Table.new(*args)
  when 'json' then Json.new(*args)
  when 'csv' then Csv.new(*args)
  else
    raise 'Invalid format type. Available options (table, json, csv)'
  end
end