Class: Renalware::UKRDC::TreatmentTimeline::GeneratorFactory
- Inherits:
-
Object
- Object
- Renalware::UKRDC::TreatmentTimeline::GeneratorFactory
- Defined in:
- app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb
Constant Summary collapse
- DEFAULT_TYPE =
"Generic"
Class Method Summary collapse
-
.call(modality) ⇒ Object
Each modality_description has a :code fiekd.
- .klass_for(type) ⇒ Object
Class Method Details
.call(modality) ⇒ Object
Each modality_description has a :code fiekd
14 15 16 17 18 19 |
# File 'app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb', line 14 def self.call(modality) type = modality.description.code&.to_s&.camelize klass = (klass_for(type) || klass_for(DEFAULT_TYPE)).new(modality) Rails.logger.debug "GeneratorFactory type = #{type} class = #{klass}" klass end |
.klass_for(type) ⇒ Object
21 22 23 |
# File 'app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb', line 21 def self.klass_for(type) "Renalware::UKRDC::TreatmentTimeline::#{type}::Generator".safe_constantize end |