Sha256: 5f2400e02f3532036f58a746ee28d144c4c5289a75e8ae76cf5ef2d77ed4565f

Contents?: true

Size: 620 Bytes

Versions: 14

Compression:

Stored size: 620 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/ukrdc"
require "attr_extras"
require "benchmark"

module Renalware
  module UKRDC
    module TreatmentTimeline
      class GeneratorFactory
        DEFAULT_TYPE = "Generic"

        # Each modality_description has a :code fiekd
        def self.call(modality)
          type = modality.description.code&.to_s&.camelize
          (klass_for(type) || klass_for(DEFAULT_TYPE)).new(modality)
        end

        def self.klass_for(type)
          "Renalware::UKRDC::TreatmentTimeline::#{type}::Generator".safe_constantize
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
renalware-core-2.0.106 app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb
renalware-core-2.0.105 app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb
renalware-core-2.0.104 app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb
renalware-core-2.0.103 app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb
renalware-core-2.0.102 app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb
renalware-core-2.0.101 app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb
renalware-core-2.0.100 app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb
renalware-core-2.0.99 app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb
renalware-core-2.0.98 app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb
renalware-core-2.0.97 app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb
renalware-core-2.0.96 app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb
renalware-core-2.0.95 app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb
renalware-core-2.0.94 app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb
renalware-core-2.0.93 app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb