Module: ProgressBar::Formatter
- Included in:
- Base
- Defined in:
- lib/ruby-progressbar/formatter.rb
Constant Summary collapse
- DEFAULT_FORMAT_STRING =
'%t: |%B|'
- DEFAULT_NON_TTY_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
14 15 16 17 |
# File 'lib/ruby-progressbar/formatter.rb', line 14 def format(new_format_string = DEFAULT_FORMAT_STRING) self.format_string = new_format_string @format.process(self) end |
#initialize(options) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/ruby-progressbar/formatter.rb', line 7 def initialize() self.format_string = [:format] || DEFAULT_FORMAT_STRING @title = [:title] || DEFAULT_TITLE super() end |
#progress ⇒ Object
23 24 25 |
# File 'lib/ruby-progressbar/formatter.rb', line 23 def progress @bar.progress end |
#title=(title) ⇒ Object
19 20 21 |
# File 'lib/ruby-progressbar/formatter.rb', line 19 def title=(title) @title = title end |
#total ⇒ Object
27 28 29 |
# File 'lib/ruby-progressbar/formatter.rb', line 27 def total @bar.total end |