Module: ProgressBar::Formatter
- Included in:
- Base
- Defined in:
- lib/progress_bar/formatter.rb
Constant Summary collapse
- DEFAULT_FORMAT_STRING =
'%t: |%B|'
- DEFAULT_TITLE =
'Progress'
Instance Method Summary collapse
- #format(new_format_string = DEFAULT_FORMAT_STRING) ⇒ Object
- #initialize(options) ⇒ Object
- #progress ⇒ Object
- #title=(title) ⇒ Object
- #total ⇒ Object
Instance Method Details
#format(new_format_string = DEFAULT_FORMAT_STRING) ⇒ Object
13 14 15 16 |
# File 'lib/progress_bar/formatter.rb', line 13 def format(new_format_string = DEFAULT_FORMAT_STRING) self.format_string = new_format_string @format.process(self) end |
#initialize(options) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/progress_bar/formatter.rb', line 6 def initialize() self.format_string = [:format] || DEFAULT_FORMAT_STRING @title = [:title] || DEFAULT_TITLE super() end |
#progress ⇒ Object
22 23 24 |
# File 'lib/progress_bar/formatter.rb', line 22 def progress @bar.progress end |
#title=(title) ⇒ Object
18 19 20 |
# File 'lib/progress_bar/formatter.rb', line 18 def title=(title) @title = title end |
#total ⇒ Object
26 27 28 |
# File 'lib/progress_bar/formatter.rb', line 26 def total @bar.total end |