Class: Bulkrax::FactoryClassFinder
- Inherits:
-
Object
- Object
- Bulkrax::FactoryClassFinder
- Defined in:
- app/services/bulkrax/factory_class_finder.rb
Defined Under Namespace
Modules: DefaultCoercer, ValkyrieMigrationCoercer
Instance Attribute Summary collapse
-
#coercer ⇒ Object
readonly
Returns the value of attribute coercer.
-
#entry ⇒ Object
readonly
Returns the value of attribute entry.
Class Method Summary collapse
Instance Method Summary collapse
- #find ⇒ Class, Nil
-
#initialize(entry:, coercer:) ⇒ FactoryClassFinder
constructor
A new instance of FactoryClassFinder.
Constructor Details
#initialize(entry:, coercer:) ⇒ FactoryClassFinder
Returns a new instance of FactoryClassFinder.
51 52 53 54 |
# File 'app/services/bulkrax/factory_class_finder.rb', line 51 def initialize(entry:, coercer:) @entry = entry @coercer = coercer end |
Instance Attribute Details
#coercer ⇒ Object (readonly)
Returns the value of attribute coercer.
55 56 57 |
# File 'app/services/bulkrax/factory_class_finder.rb', line 55 def coercer @coercer end |
#entry ⇒ Object (readonly)
Returns the value of attribute entry.
55 56 57 |
# File 'app/services/bulkrax/factory_class_finder.rb', line 55 def entry @entry end |
Class Method Details
.find(entry:, coercer: Bulkrax.factory_class_name_coercer || DefaultCoercer) ⇒ Class
47 48 49 |
# File 'app/services/bulkrax/factory_class_finder.rb', line 47 def self.find(entry:, coercer: Bulkrax.factory_class_name_coercer || DefaultCoercer) new(entry: entry, coercer: coercer).find end |
Instance Method Details
#find ⇒ Class, Nil
61 62 63 64 65 66 67 |
# File 'app/services/bulkrax/factory_class_finder.rb', line 61 def find coercer.call(name) rescue NameError nil rescue entry.default_work_type.constantize end |