Class: Ea::Cli::Command::Export

Inherits:
Base
  • Object
show all
Defined in:
lib/ea/cli/command/export.rb

Overview

ea export SUB FILE where SUB ∈ json, plantuml, xsd.

Routes to the appropriate Exporter based on sub. Each exporter lives under Ea::Export::* and implements call(model, **opts) → String. Adding a new format = adding a new exporter (OCP), no changes to this command.

Constant Summary collapse

COLUMNS =
%i[format bytes_written path].freeze

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Ea::Cli::Command::Base

Instance Method Details

#callObject



17
18
19
20
21
22
# File 'lib/ea/cli/command/export.rb', line 17

def call
  validate_file!(file_path)
  output = exporter.call(model, **exporter_options)
  path = write_output(output, default_name: default_name)
  formatter.render([[sub, output.bytesize, path]], columns: COLUMNS)
end