script/worker_analysis in image_optim-0.31.1 vs script/worker_analysis in image_optim-0.31.2

- old
+ new

@@ -9,11 +9,10 @@ require 'progress' require 'shellwords' require 'gdbm' require 'digest' require 'erb' -require 'ostruct' DIR = 'tmp' Pathname(DIR).mkpath Array.class_eval do @@ -170,11 +169,11 @@ end end def source_digest @source_digest ||= begin - source_path = __getobj__.method(:optimize).source_location[0] + source_path = __getobj__.class.instance_method(:optimize).source_location[0] Digest::SHA256.file(source_path).hexdigest end end def options_string(options) @@ -513,25 +512,22 @@ end def analyse(paths) results = collect_results(paths) - template = ERB.new(template_path.read, nil, '>') + template = ERB.new(template_path.read, trim_mode: '>') by_format = results.group_by(&:format) formats = by_format.keys.sort basenames = Hash[formats.map do |format| [format, "worker-analysis-#{format}.html"] end] formats.each do |format| stats = Stats.new('all', by_format[format], worker_ids2names) path = FSPath("#{DIR}/#{basenames[format]}") - model = { - stats_format: format, - stats: stats, - format_links: basenames, - template_dir: template_path.dirname.relative_path_from(path.dirname), - } - html = template.result(OpenStruct.new(model).instance_eval{ binding }) + stats_format = format + format_links = basenames + template_dir = template_path.dirname.relative_path_from(path.dirname) + html = template.result(binding) path.write(html) puts "Created #{path}" end end