Sha256: 07a69551f33866e945d3f7fec123d269f079b23dea147b31fc31426f016cf531

Contents?: true

Size: 1 KB

Versions: 8

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require_dependency "renalware"

module Renalware
  module PD
    def self.table_name_prefix
      "pd_"
    end

    def self.cast_patient(patient)
      return patient if patient.is_a?(::Renalware::PD::Patient)

      ActiveType.cast(patient, ::Renalware::PD::Patient)
    end

    # PD-specific configuration
    #
    # You can override default settings here in an initializer in the host app like so:
    #   Renalware::PD.configure do |config|
    #     config.delivery_intervals = [2.days, 1.week, 3.weeks, 1.year]
    #   end
    #
    #  You can access PD configuration like so
    #    Renalware::PD.config.delivery_intervals
    #
    class Configuration
      include ActiveSupport::Configurable

      config_accessor(:delivery_intervals) { [1.week, 2.weeks, 3.weeks, 4.weeks] }

      config_accessor(:training_durations) { (1..15).map(&:days) }
    end

    def self.config
      @config ||= Configuration.new
    end

    def self.configure
      yield config
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
renalware-core-2.0.159 app/models/renalware/pd.rb
renalware-core-2.0.158 app/models/renalware/pd.rb
renalware-core-2.0.157 app/models/renalware/pd.rb
renalware-core-2.0.156 app/models/renalware/pd.rb
renalware-core-2.0.155 app/models/renalware/pd.rb
renalware-core-2.0.153 app/models/renalware/pd.rb
renalware-core-2.0.152 app/models/renalware/pd.rb
renalware-core-2.0.151 app/models/renalware/pd.rb