Class: Stash::Merritt::SubmissionPackage::MerrittDeleteBuilder

Inherits:
Repo::FileBuilder
  • Object
show all
Defined in:
lib/stash/merritt/submission_package/merritt_delete_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource_id:) ⇒ MerrittDeleteBuilder

Returns a new instance of MerrittDeleteBuilder.



9
10
11
12
# File 'lib/stash/merritt/submission_package/merritt_delete_builder.rb', line 9

def initialize(resource_id:)
  super(file_name: 'mrt-delete.txt')
  @resource_id = resource_id
end

Instance Attribute Details

#resource_idObject (readonly)

Returns the value of attribute resource_id.



7
8
9
# File 'lib/stash/merritt/submission_package/merritt_delete_builder.rb', line 7

def resource_id
  @resource_id
end

Instance Method Details

#contentsObject



18
19
20
21
# File 'lib/stash/merritt/submission_package/merritt_delete_builder.rb', line 18

def contents
  del_files = resource.file_uploads.deleted
  del_files.blank? ? nil : del_files.map(&:upload_file_name).join("\n")
end

#resourceObject



14
15
16
# File 'lib/stash/merritt/submission_package/merritt_delete_builder.rb', line 14

def resource
  @resource ||= StashEngine::Resource.find(resource_id)
end