Class: CommandLineReporter::NestedFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/dnsblim/cli/tables.rb

Instance Method Summary collapse

Instance Method Details

#format(options, block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/dnsblim/cli/tables.rb', line 8

def format(options, block)
  validate_options(options, *VALID_OPTIONS)

  indent_level :incr

  padding = ' ' * @indent_level * (options[:indent_size] || indent_size)

  message_str = padding + (options[:message] || message_string)
  complete_str = options[:complete] || complete_string

  if options[:type] == 'inline'
    colorize(message_str.to_s, true, options)
  else
    colorize(message_str, false, options)
    complete_str = padding + complete_str
  end

  block.call

  colorize(complete_str, false, options)

  indent_level :decr
end