Class: CommandLineReporter::NestedFormatter
- Inherits:
-
Object
- Object
- CommandLineReporter::NestedFormatter
- Includes:
- OptionsValidator, Singleton
- Defined in:
- lib/command_line_reporter/formatter/nested.rb
Constant Summary collapse
- VALID_OPTIONS =
%i[message type complete indent_size color bold].freeze
Instance Attribute Summary collapse
-
#bold ⇒ Object
Returns the value of attribute bold.
-
#color ⇒ Object
Returns the value of attribute color.
-
#complete_string ⇒ Object
Returns the value of attribute complete_string.
-
#indent_size ⇒ Object
Returns the value of attribute indent_size.
-
#message_string ⇒ Object
Returns the value of attribute message_string.
Instance Method Summary collapse
Methods included from OptionsValidator
Instance Attribute Details
#bold ⇒ Object
Returns the value of attribute bold.
10 11 12 |
# File 'lib/command_line_reporter/formatter/nested.rb', line 10 def bold @bold end |
#color ⇒ Object
Returns the value of attribute color.
10 11 12 |
# File 'lib/command_line_reporter/formatter/nested.rb', line 10 def color @color end |
#complete_string ⇒ Object
Returns the value of attribute complete_string.
10 11 12 |
# File 'lib/command_line_reporter/formatter/nested.rb', line 10 def complete_string @complete_string end |
#indent_size ⇒ Object
Returns the value of attribute indent_size.
10 11 12 |
# File 'lib/command_line_reporter/formatter/nested.rb', line 10 def indent_size @indent_size end |
#message_string ⇒ Object
Returns the value of attribute message_string.
10 11 12 |
# File 'lib/command_line_reporter/formatter/nested.rb', line 10 def @message_string end |
Instance Method Details
#format(options, block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/command_line_reporter/formatter/nested.rb', line 12 def format(, block) (, *VALID_OPTIONS) indent_level :incr padding = ' ' * @indent_level * ([:indent_size] || indent_size) = padding + ([:message] || ) complete_str = [:complete] || complete_string if [:type] == 'inline' colorize("#{}...", true, ) else colorize(, false, ) complete_str = padding + complete_str end block.call colorize(complete_str, false, ) indent_level :decr end |