Class: Bulkrax::SampleCsvService::ModelLoader
- Inherits:
-
Object
- Object
- Bulkrax::SampleCsvService::ModelLoader
- Defined in:
- app/services/bulkrax/sample_csv_service/model_loader.rb
Overview
Handles model loading based on configuration
Instance Attribute Summary collapse
-
#models ⇒ Object
readonly
Returns the value of attribute models.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(model_name) ⇒ ModelLoader
constructor
A new instance of ModelLoader.
Constructor Details
#initialize(model_name) ⇒ ModelLoader
Returns a new instance of ModelLoader.
8 9 10 |
# File 'app/services/bulkrax/sample_csv_service/model_loader.rb', line 8 def initialize(model_name) @models = load_models(model_name) end |
Instance Attribute Details
#models ⇒ Object (readonly)
Returns the value of attribute models.
6 7 8 |
# File 'app/services/bulkrax/sample_csv_service/model_loader.rb', line 6 def models @models end |
Class Method Details
.determine_klass_for(model_name) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/services/bulkrax/sample_csv_service/model_loader.rb', line 12 def self.determine_klass_for(model_name) if Bulkrax.config.object_factory == Bulkrax::ValkyrieObjectFactory Valkyrie.config.resource_class_resolver.call(model_name) else model_name.constantize end rescue StandardError nil end |