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(format_string = DEFAULT_FORMAT_STRING) ⇒ Object
- #initialize(options) ⇒ Object
- #progress ⇒ Object
- #title=(title) ⇒ Object
- #total ⇒ Object
Instance Method Details
#format(format_string = DEFAULT_FORMAT_STRING) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/progress_bar/formatter.rb', line 13 def format(format_string = DEFAULT_FORMAT_STRING) @format_string = format_string @format = ProgressBar::Format::Base.new(format_string) process end |
#initialize(options) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/progress_bar/formatter.rb', line 6 def initialize() @format_string = [:format] || DEFAULT_FORMAT_STRING @title = [:title] || DEFAULT_TITLE super() end |
#progress ⇒ Object
24 25 26 |
# File 'lib/progress_bar/formatter.rb', line 24 def progress @bar.progress end |
#title=(title) ⇒ Object
20 21 22 |
# File 'lib/progress_bar/formatter.rb', line 20 def title=(title) @title = title end |
#total ⇒ Object
28 29 30 |
# File 'lib/progress_bar/formatter.rb', line 28 def total @bar.total end |