app/services/hyrax/workflow/method_generator.rb in hyrax-3.0.0.pre.rc1 vs app/services/hyrax/workflow/method_generator.rb in hyrax-3.0.0.pre.rc2
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
module Hyrax
module Workflow
# Responsible for writing the database records for the given :action and :method list.
class MethodGenerator
# @api public
@@ -27,29 +28,29 @@
end
end
private
- def update_list
- update_from = list.dup
- nodes_to_update = action.triggered_methods.order(:weight)
- nodes_to_update.each do |node|
- node.update!(service_name: update_from.shift)
- end
+ def update_list
+ update_from = list.dup
+ nodes_to_update = action.triggered_methods.order(:weight)
+ nodes_to_update.each do |node|
+ node.update!(service_name: update_from.shift)
+ end
- count = nodes_to_update.count
- # If there are more new values than old values, add them.
- until update_from.empty?
- action.triggered_methods.create!(service_name: update_from.shift, weight: count)
- count += 1
- end
+ count = nodes_to_update.count
+ # If there are more new values than old values, add them.
+ until update_from.empty?
+ action.triggered_methods.create!(service_name: update_from.shift, weight: count)
+ count += 1
end
+ end
- def replace_list
- action.triggered_methods.destroy_all
- list.each_with_index do |name, i|
- action.triggered_methods.create!(service_name: name, weight: i)
- end
+ def replace_list
+ action.triggered_methods.destroy_all
+ list.each_with_index do |name, i|
+ action.triggered_methods.create!(service_name: name, weight: i)
end
+ end
end
end
end