Class: Luck::DoubleProgressBar

Inherits:
ProgressBar show all
Defined in:
lib/luck/progressbar.rb

Instance Attribute Summary collapse

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

Methods inherited from ProgressBar

#percentage

Methods inherited from Control

#focus!, #height, #width

Constructor Details

#initialize(*args) ⇒ DoubleProgressBar

Returns a new instance of DoubleProgressBar.



32
33
34
35
36
37
38
# File 'lib/luck/progressbar.rb', line 32

def initialize *args
  @maximum2 = 1
  @value2 = 0
  @bar2 = '-'
  @arrow2 = '>'
  super
end

Instance Attribute Details

#arrow2Object

Returns the value of attribute arrow2.



30
31
32
# File 'lib/luck/progressbar.rb', line 30

def arrow2
  @arrow2
end

#bar2Object

Returns the value of attribute bar2.



30
31
32
# File 'lib/luck/progressbar.rb', line 30

def bar2
  @bar2
end

#maximum2Object

Returns the value of attribute maximum2.



30
31
32
# File 'lib/luck/progressbar.rb', line 30

def maximum2
  @maximum2
end

#value2Object

Returns the value of attribute value2.



30
31
32
# File 'lib/luck/progressbar.rb', line 30

def value2
  @value2
end

Instance Method Details

#percentage2Object



40
41
42
# File 'lib/luck/progressbar.rb', line 40

def percentage2
  @value2.to_f / @maximum2.to_f
end

#redrawObject



48
49
50
51
# File 'lib/luck/progressbar.rb', line 48

def redraw
  super
  @display.place y1, x1, @precap + (@bar2 * (percentage2 * (width - @precap.size - @postcap.size)) + @arrow2)
end

#template(str) ⇒ Object



44
45
46
# File 'lib/luck/progressbar.rb', line 44

def template str
  @precap, @bar2, @arrow2, @bar, @arrow, @blank, @postcap = str.unpack 'aaaaaaa'
end