Module: Aptible::CLI::Renderer

Defined in:
lib/aptible/cli/renderer.rb,
lib/aptible/cli/renderer/base.rb,
lib/aptible/cli/renderer/json.rb,
lib/aptible/cli/renderer/text.rb

Defined Under Namespace

Classes: Base, Json, Text

Constant Summary collapse

FORMAT_VAR =
'APTIBLE_OUTPUT_FORMAT'.freeze

Class Method Summary collapse

Class Method Details

.currentObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/aptible/cli/renderer.rb', line 12

def self.current
  case (format = ENV[FORMAT_VAR])
  when 'json'
    Json.new
  when 'text'
    Text.new
  when nil
    Text.new
  else
    raise UserError, "Invalid #{FORMAT_VAR}: #{format}"
  end
end