Class: HammerCLI::Output::Adapter::Base

Inherits:
Abstract
  • Object
show all
Defined in:
lib/hammer_cli/output/adapter/base.rb

Constant Summary collapse

GROUP_INDENT =
" "*4
LABEL_DIVIDER =
": "

Instance Method Summary collapse

Methods inherited from Abstract

#initialize, #paginate_by_default?, #print_error, #print_message, #tags

Constructor Details

This class inherits a constructor from HammerCLI::Output::Adapter::Abstract

Instance Method Details

#featuresObject



7
8
9
10
11
# File 'lib/hammer_cli/output/adapter/base.rb', line 7

def features
  return %i[serialized rich_text multiline] if tags.empty?

  tags.map { |t| HammerCLI::Output::Utils.tag_to_feature(t) }
end


17
18
19
20
21
22
# File 'lib/hammer_cli/output/adapter/base.rb', line 17

def print_collection(fields, collection, options = {})
  collection.each do |data|
    output_stream.puts render_fields(fields, data)
    output_stream.puts
  end
end


13
14
15
# File 'lib/hammer_cli/output/adapter/base.rb', line 13

def print_record(fields, record)
  print_collection(fields, [record].flatten(1))
end