Module: Bulkrax::FactoryClassFinder::ValkyrieMigrationCoercer
- Defined in:
- app/services/bulkrax/factory_class_finder.rb
Overview
A name coercer that favors classes that end with “Resource” but will attempt to fallback to those that don’t.
Constant Summary collapse
- SUFFIX =
"Resource"
Class Method Summary collapse
-
.call(name, suffix: SUFFIX) ⇒ Class
When the name is a coercible constant.
Class Method Details
.call(name, suffix: SUFFIX) ⇒ Class
Returns when the name is a coercible constant.
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/services/bulkrax/factory_class_finder.rb', line 29 def self.call(name, suffix: SUFFIX) if name.end_with?(suffix) name.constantize elsif name == "FileSet" Bulkrax.file_model_class else begin "#{name}#{suffix}".constantize rescue NameError name.constantize end end end |