module Tsuga::Service::Clusterer::SteppedProgressBar
Constants
- FACTOR
- MAX
- MIN
Public Instance Methods
set_phase(depth, phase, count)
click to toggle source
# File lib/tsuga/service/clusterer.rb, line 142 def set_phase(depth, phase, count) _compute_totals @current_phase = phase @current_depth = depth @current_count = count end
set_progress(count)
click to toggle source
# File lib/tsuga/service/clusterer.rb, line 149 def set_progress(count) key = [@current_depth,@current_phase] self.progress = @phase_total[key] - @phase_subtotal[key] * count / @current_count rescue Exception => e require 'pry' ; require 'pry-nav' ; binding.pry end
Private Instance Methods
_compute_totals()
click to toggle source
# File lib/tsuga/service/clusterer.rb, line 163 def _compute_totals return if @phase_total sum = 0 @phase_total = {} @phase_subtotal = {} MAX.downto(MIN) do |depth| depth_weight = FACTOR ** (MAX-depth) [1,1,1].each_with_index do |phase_weight, phase_index| phase_subtotal = depth_weight * phase_weight sum += phase_subtotal @phase_total[[depth,phase_index]] = sum @phase_subtotal[[depth,phase_index]] = phase_subtotal end end self.total = sum end