Class: Luck::DoubleProgressBar
- Inherits:
-
ProgressBar
- Object
- Control
- ProgressBar
- Luck::DoubleProgressBar
- Defined in:
- lib/luck/progressbar.rb
Instance Attribute Summary collapse
-
#arrow2 ⇒ Object
Returns the value of attribute arrow2.
-
#bar2 ⇒ Object
Returns the value of attribute bar2.
-
#maximum2 ⇒ Object
Returns the value of attribute maximum2.
-
#value2 ⇒ Object
Returns the value of attribute value2.
Attributes inherited from ProgressBar
#arrow, #bar, #blank, #maximum, #postcap, #precap, #value
Attributes inherited from Control
#display, #pane, #x1, #x2, #y1, #y2
Instance Method Summary collapse
-
#initialize(*args) ⇒ DoubleProgressBar
constructor
A new instance of DoubleProgressBar.
- #percentage2 ⇒ Object
- #redraw ⇒ Object
- #template(str) ⇒ Object
Methods inherited from ProgressBar
Methods inherited from Control
Constructor Details
#initialize(*args) ⇒ DoubleProgressBar
Returns a new instance of DoubleProgressBar.
33 34 35 36 37 38 39 |
# File 'lib/luck/progressbar.rb', line 33 def initialize *args @maximum2 = 1 @value2 = 0 @bar2 = '-' @arrow2 = '>' super end |
Instance Attribute Details
#arrow2 ⇒ Object
Returns the value of attribute arrow2.
31 32 33 |
# File 'lib/luck/progressbar.rb', line 31 def arrow2 @arrow2 end |
#bar2 ⇒ Object
Returns the value of attribute bar2.
31 32 33 |
# File 'lib/luck/progressbar.rb', line 31 def @bar2 end |
#maximum2 ⇒ Object
Returns the value of attribute maximum2.
31 32 33 |
# File 'lib/luck/progressbar.rb', line 31 def maximum2 @maximum2 end |
#value2 ⇒ Object
Returns the value of attribute value2.
31 32 33 |
# File 'lib/luck/progressbar.rb', line 31 def value2 @value2 end |
Instance Method Details
#percentage2 ⇒ Object
41 42 43 44 |
# File 'lib/luck/progressbar.rb', line 41 def percentage2 return 0 if @maximum2 == 0 @value2.to_f / @maximum2.to_f end |
#redraw ⇒ Object
50 51 52 53 |
# File 'lib/luck/progressbar.rb', line 50 def redraw super @display.place y1, x1, @precap + (@bar2 * (percentage2 * (width - @precap.size - @postcap.size)) + @arrow2) end |
#template(str) ⇒ Object
46 47 48 |
# File 'lib/luck/progressbar.rb', line 46 def template str @precap, @bar2, @arrow2, @bar, @arrow, @blank, @postcap = str.unpack 'aaaaaaa' end |