Class: HammerCLI::Output::Adapter::Base
- Inherits:
-
Abstract
- Object
- Abstract
- HammerCLI::Output::Adapter::Base
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
Instance Method Details
#features ⇒ Object
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
|
#print_collection(fields, collection, options = {}) ⇒ Object
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
|
#print_record(fields, record) ⇒ Object
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
|