Class: ProgressBar::Components::Bar
- Inherits:
-
Object
- Object
- ProgressBar::Components::Bar
- Defined in:
- lib/ruby-progressbar/components/bar.rb
Constant Summary collapse
- DEFAULT_PROGRESS_MARK =
'='
- DEFAULT_REMAINDER_MARK =
' '
- DEFAULT_UPA_STEPS =
['=---', '-=--', '--=-', '---=']
Instance Attribute Summary collapse
-
#length ⇒ Object
Returns the value of attribute length.
-
#progress ⇒ Object
Returns the value of attribute progress.
-
#progress_mark ⇒ Object
Returns the value of attribute progress_mark.
-
#remainder_mark ⇒ Object
Returns the value of attribute remainder_mark.
-
#upa_steps ⇒ Object
Returns the value of attribute upa_steps.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Bar
constructor
A new instance of Bar.
- #to_s(options = { :format => :standard }) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Bar
Returns a new instance of Bar.
17 18 19 20 21 22 23 |
# File 'lib/ruby-progressbar/components/bar.rb', line 17 def initialize( = {}) self.upa_steps = [:unknown_progress_animation_steps] || DEFAULT_UPA_STEPS self.progress_mark = [:progress_mark] || DEFAULT_PROGRESS_MARK self.remainder_mark = [:remainder_mark] || DEFAULT_REMAINDER_MARK self.progress = [:progress] self.length = [:length] end |
Instance Attribute Details
#length ⇒ Object
Returns the value of attribute length.
11 12 13 |
# File 'lib/ruby-progressbar/components/bar.rb', line 11 def length @length end |
#progress ⇒ Object
Returns the value of attribute progress.
11 12 13 |
# File 'lib/ruby-progressbar/components/bar.rb', line 11 def progress @progress end |
#progress_mark ⇒ Object
Returns the value of attribute progress_mark.
11 12 13 |
# File 'lib/ruby-progressbar/components/bar.rb', line 11 def progress_mark @progress_mark end |
#remainder_mark ⇒ Object
Returns the value of attribute remainder_mark.
11 12 13 |
# File 'lib/ruby-progressbar/components/bar.rb', line 11 def remainder_mark @remainder_mark end |
#upa_steps ⇒ Object
Returns the value of attribute upa_steps.
11 12 13 |
# File 'lib/ruby-progressbar/components/bar.rb', line 11 def upa_steps @upa_steps end |
Instance Method Details
#to_s(options = { :format => :standard }) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/ruby-progressbar/components/bar.rb', line 25 def to_s( = { :format => :standard }) if progress.unknown? unknown_string elsif [:format] == :standard "#{standard_complete_string}#{incomplete_string}" elsif [:format] == :integrated_percentage "#{integrated_percentage_complete_string}#{incomplete_string}" end end |