Skip to content

Commit

Permalink
refactor #conditionally_destroy_existing_files
Browse files Browse the repository at this point in the history
This refactor was necessary because even though klass == ImageResource, which inherits from Valkyrie::Resouce through it's chain, klass === Valkyrie::Resource was returning false.
  • Loading branch information
ShanaLMoore committed Mar 8, 2024
1 parent 9d0695c commit 1a007db
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/factories/bulkrax/valkyrie_object_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ def new_remote_files

def conditionally_destroy_existing_files
return unless @replace_files
case klass
when Hyrax::PcdmCollection, Hyrax::FileSet

if [Hyrax::PcdmCollection, Hyrax::FileSet].include?(klass)
return
when Valkyrie::Resource
elsif klass.ancestors.include?(Valkyrie::Resource)
destroy_existing_files
else
raise "Unexpected #{klass} for #{self.class}##{__method__}"
Expand Down

0 comments on commit 1a007db

Please sign in to comment.