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
15 16 17 18 |
# File 'lib/ruby-progressbar/formatter.rb', line 15 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 13 |
# File 'lib/ruby-progressbar/formatter.rb', line 7 def initialize() @format_string = nil self.format_string = [:format] || DEFAULT_FORMAT_STRING @title = [:title] || DEFAULT_TITLE super() end |
#progress ⇒ Object
24 25 26 |
# File 'lib/ruby-progressbar/formatter.rb', line 24 def progress @bar.progress end |
#title=(title) ⇒ Object
20 21 22 |
# File 'lib/ruby-progressbar/formatter.rb', line 20 def title=(title) @title = title end |
#total ⇒ Object
28 29 30 |
# File 'lib/ruby-progressbar/formatter.rb', line 28 def total @bar.total end |