class ProgressMonitor::Task::PercentageCalculation::AverageCompletionOfSubtasks

Attributes

task[R]

Public Class Methods

new(task) click to toggle source
# File lib/progress_monitor/task/percentage_calculation/average_completion_of_subtasks.rb, line 7
def initialize(task)
  @task = task
end

Public Instance Methods

perform() click to toggle source
# File lib/progress_monitor/task/percentage_calculation/average_completion_of_subtasks.rb, line 11
def perform
  if task.subtasks.any?
    Utils.average task.subtasks.map(&:completion_percent)
  end
rescue
  nil
end