Updated

app/lib/admin / task_runner.rb

A
49 lines of codes
5 methods
4.6 complexity/method
1 churn
22.96 complexity
0 duplications
module Admin class TaskRunner
  1. Admin::TaskRunner has no descriptive comment
TASKS = { "backfill_constituencies" => lambda { |params| case params[:since] when "week" since = 1.week.ago when "month" since = 1.month.ago when "three_months" since = 3.months.ago else since = nil end BackfillConstituenciesJob.perform_later(since: since.try(:iso8601)) } } attr_reader :params class << self def run(params) new(params).run.any? rescue StandardError => e
  1. Admin::TaskRunner#run has the variable name 'e'
Appsignal.send_exception(e) return false end end def initialize(params) @params = params end def run tasks.each { |task| run_task(task) } end private def run_task(task) TASKS[task].call(params[task]) end def tasks Array(params[:tasks]).select { |t| TASKS.key?(t) }
  1. Admin::TaskRunner#tasks has the variable name 't'
end end end