script/worker_analysis in image_optim-0.26.5 vs script/worker_analysis in image_optim-0.27.0
- old
+ new
@@ -135,17 +135,18 @@
end
# Delegate to worker with short id
class WorkerVariant < DelegateClass(ImageOptim::Worker)
attr_reader :name, :id, :cons_id, :required
+
def initialize(klass, image_optim, options)
@required = options.delete(:required)
@run_order = options.delete(:run_order)
allow_consecutive_on = Array(options.delete(:allow_consecutive_on))
@image_optim = image_optim
@name = klass.bin_sym.to_s + options_string(options)
- __setobj__(klass.new(image_optim, options))
+ super(klass.new(image_optim, options))
@id = klass.bin_sym.to_s + options_string(self.options)
@cons_id = [klass, allow_consecutive_on.map{ |key| [key, send(key)] }]
end
def run_order
@@ -450,10 +451,11 @@
# Worker usage
class Worker
attr_reader :name
attr_reader :success_count
attr_reader :time, :avg_time
+
def initialize(name, steps)
@name = name
@success_count = steps.count(&:success)
@time = steps.sum(&:time)
@avg_time = time / steps.length
@@ -463,9 +465,10 @@
success_count == 0
end
end
attr_reader :name, :results, :ids2names
+
def initialize(name, results, ids2names)
@name = name.to_s
@results = results
@ids2names = ids2names
end