class ProgressBar::Components::Bar
Constants
- DEFAULT_PROGRESS_MARK
- DEFAULT_REMAINDER_MARK
- DEFAULT_UPA_STEPS
Attributes
Public Class Methods
Source
# File lib/ruby-progressbar/components/bar.rb, line 17 def initialize(options = {}) self.upa_steps = options[:unknown_progress_animation_steps] || DEFAULT_UPA_STEPS self.progress_mark = options[:progress_mark] || DEFAULT_PROGRESS_MARK self.remainder_mark = options[:remainder_mark] || DEFAULT_REMAINDER_MARK self.progress = options[:progress] self.length = options[:length] end
Public Instance Methods
Source
# File lib/ruby-progressbar/components/bar.rb, line 35 def bar(length) self.length = length standard_complete_string end
Source
# File lib/ruby-progressbar/components/bar.rb, line 63 def bar_with_percentage(length) self.length = length integrated_percentage_complete_string end
Source
# File lib/ruby-progressbar/components/bar.rb, line 41 def complete_bar(length) self.length = length to_s(:format => :standard) end
Source
# File lib/ruby-progressbar/components/bar.rb, line 47 def complete_bar_with_percentage(length) self.length = length to_s(:format => :integrated_percentage) end
Source
# File lib/ruby-progressbar/components/bar.rb, line 53 def incomplete_space(length) self.length = length if progress.unknown? unknown_string else incomplete_string end end
Source
# File lib/ruby-progressbar/components/bar.rb, line 25 def to_s(options = { :format => :standard }) if progress.unknown? unknown_string elsif options[:format] == :standard "#{standard_complete_string}#{incomplete_string}" elsif options[:format] == :integrated_percentage "#{integrated_percentage_complete_string}#{incomplete_string}" end end