Class: Hyrax::Transactions::Steps::AddFileSets
- Inherits:
-
Object
- Object
- Hyrax::Transactions::Steps::AddFileSets
- Defined in:
- lib/hyrax/transactions/steps/add_file_sets.rb
Overview
Adds a Hyrax::FileSet
Instance Method Summary collapse
- #call(obj, uploaded_files: [], file_set_params: []) ⇒ Dry::Monads::Result
-
#initialize(handler: Hyrax::WorkUploadsHandler) ⇒ AddFileSets
constructor
A new instance of AddFileSets.
Constructor Details
#initialize(handler: Hyrax::WorkUploadsHandler) ⇒ AddFileSets
Returns a new instance of AddFileSets.
16 17 18 |
# File 'lib/hyrax/transactions/steps/add_file_sets.rb', line 16 def initialize(handler: Hyrax::WorkUploadsHandler) @handler = handler end |
Instance Method Details
#call(obj, uploaded_files: [], file_set_params: []) ⇒ Dry::Monads::Result
26 27 28 29 30 31 32 |
# File 'lib/hyrax/transactions/steps/add_file_sets.rb', line 26 def call(obj, uploaded_files: [], file_set_params: []) if @handler.new(work: obj).add(files: uploaded_files, file_set_params: file_set_params).attach Success(obj) else Failure[:failed_to_attach_file_sets, uploaded_files] end end |