Class: CommandLineReporter::ProgressFormatter
- Inherits:
-
Object
- Object
- CommandLineReporter::ProgressFormatter
- Includes:
- OptionsValidator, Singleton
- Defined in:
- lib/command_line_reporter/formatter/progress.rb
Constant Summary collapse
- VALID_OPTIONS =
%i[indicator color bold].freeze
Instance Method Summary collapse
Methods included from OptionsValidator
Instance Method Details
#format(options, block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/command_line_reporter/formatter/progress.rb', line 12 def format(, block) (, *VALID_OPTIONS) self.indicator = [:indicator] if [:indicator] self.color = [:color] self.bold = [:bold] || false block.call puts end |
#indicator ⇒ Object
33 34 35 |
# File 'lib/command_line_reporter/formatter/progress.rb', line 33 def indicator @indicator ||= '.' end |
#progress(override = nil) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/command_line_reporter/formatter/progress.rb', line 24 def progress(override = nil) str = override || indicator str = str.send(color) if color str = str.send('bold') if bold print str end |