Class: Palaver::Gauge

Inherits:
Base
  • Object
show all
Defined in:
lib/palaver/gauge.rb

Instance Method Summary collapse

Methods inherited from Base

#height, #text, #width, #with_tempfile

Constructor Details

#initialize(options) ⇒ Gauge

Returns a new instance of Gauge.



7
8
9
10
# File 'lib/palaver/gauge.rb', line 7

def initialize(options)
  @inital_percentage = 0
  super(options)
end

Instance Method Details

#closeObject



25
26
27
# File 'lib/palaver/gauge.rb', line 25

def close
  @pipe.close
end

#percentage(p) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/palaver/gauge.rb', line 17

def percentage(p)
  if @pipe then
    @pipe.puts p
  else
    @inital_percentage = p
  end
end

#showObject



12
13
14
15
# File 'lib/palaver/gauge.rb', line 12

def show
  cmd = "dialog #@common_options --gauge '#@text' #@height #@width #@inital_percentage"
  @pipe = IO.popen(cmd,"w")
end