Class: HammerCLI::Output::Adapter::Abstract
- Inherits:
-
Object
- Object
- HammerCLI::Output::Adapter::Abstract
show all
- Defined in:
- lib/hammer_cli/output/adapter/abstract.rb
Instance Method Summary
collapse
Constructor Details
#initialize(context = {}, formatters = {}, filters = {}) ⇒ Abstract
Returns a new instance of Abstract.
9
10
11
12
13
14
15
|
# File 'lib/hammer_cli/output/adapter/abstract.rb', line 9
def initialize(context={}, formatters={}, filters = {})
context[:verbosity] ||= HammerCLI::V_VERBOSE
@context = context
@formatters = HammerCLI::Output::Formatters::FormatterLibrary.new(filter_formatters(formatters))
@paginate_by_default = true
@filters = filters
end
|
Instance Method Details
#paginate_by_default? ⇒ Boolean
17
18
19
|
# File 'lib/hammer_cli/output/adapter/abstract.rb', line 17
def paginate_by_default?
!!@paginate_by_default
end
|
#print_collection(fields, collection) ⇒ Object
41
42
43
|
# File 'lib/hammer_cli/output/adapter/abstract.rb', line 41
def print_collection(fields, collection)
raise NotImplementedError
end
|
#print_error(msg, details = nil, msg_params = {}) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/hammer_cli/output/adapter/abstract.rb', line 25
def print_error(msg, details=nil, msg_params={})
details = details.split("\n") if details.kind_of? String
if details
indent = " "
msg += ":\n"
msg += indent + details.join("\n"+indent)
end
$stderr.puts msg.format(msg_params)
end
|
#print_message(msg, msg_params = {}) ⇒ Object
21
22
23
|
# File 'lib/hammer_cli/output/adapter/abstract.rb', line 21
def print_message(msg, msg_params={})
puts msg.format(msg_params)
end
|
#print_record(fields, record) ⇒ Object
37
38
39
|
# File 'lib/hammer_cli/output/adapter/abstract.rb', line 37
def print_record(fields, record)
raise NotImplementedError
end
|
#reset_context ⇒ Object
45
46
47
|
# File 'lib/hammer_cli/output/adapter/abstract.rb', line 45
def reset_context
@context.delete(:fields)
end
|
5
6
7
|
# File 'lib/hammer_cli/output/adapter/abstract.rb', line 5
def tags
[]
end
|