Method: EPO::DB#batch_save_actions

Defined in:
lib/epo/core/db.rb

#batch_save_actions(root, resources, persps, exts) ⇒ Object

Yields all the action needed to store all the resources at perspectives persps and with formats exts. All actions respond to :perform (it is when they’re executed). If no block given, returns an Enumerator with these actions.



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/epo/core/db.rb', line 174

def batch_save_actions(root, resources, persps, exts)
  if block_given?
    resources.each do |resource|
      db_path = File.join(root, resource.path(identifying_sym))
      yield PrepareDirAction.new(db_path)
      exts.each do |ext|
        persps.each do |persp|
          basename = basename_for_persp_and_ext(persp, ext)
          resource_path = File.join(db_path, basename) 
          yield StoreResourceAction.new(resource_path, resource, persp, ext)
        end
      end
    end
  else
    Enumerator.new(self, :batch_save_actions, root, resources, persps, exts)
  end
end