Class: AdLint::ProgressMonitor

Inherits:
Object
  • Object
show all
Defined in:
lib/adlint/monitor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fpath, phase_num, verbose) ⇒ ProgressMonitor

Returns a new instance of ProgressMonitor.



65
66
67
68
69
70
71
# File 'lib/adlint/monitor.rb', line 65

def initialize(fpath, phase_num, verbose)
  @fpath      = fpath
  @phase_num  = phase_num
  @verbose    = verbose
  @start_time = Time.now
  @cur_phase  = 0
end

Instance Attribute Details

#locationObject

Returns the value of attribute location.



73
74
75
# File 'lib/adlint/monitor.rb', line 73

def location
  @location
end

#progressObject

Returns the value of attribute progress.



74
75
76
# File 'lib/adlint/monitor.rb', line 74

def progress
  @progress
end

Instance Method Details

#abortObject



94
95
96
# File 'lib/adlint/monitor.rb', line 94

def abort
  draw_aborted
end

#finishObject



85
86
87
88
89
90
91
92
# File 'lib/adlint/monitor.rb', line 85

def finish
  @progress = @total
  if @cur_phase == @phase_num
    draw_finished
  else
    draw
  end
end

#start(title, total = 1) ⇒ Object



76
77
78
79
80
81
82
83
# File 'lib/adlint/monitor.rb', line 76

def start(title, total = 1)
  @total    = total
  @title    = title
  @location = nil
  @progress = 0
  @cur_phase += 1
  draw
end