Sha256: 16924d1ca5a7b79eddf3ecd612eb83d0df940d79b3530070154c876da1f7c68b

Contents?: true

Size: 703 Bytes

Versions: 65

Compression:

Stored size: 703 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/ukrdc"
require "attr_extras"

module Renalware
  module UKRDC
    module TreatmentTimeline
      module PD
        class RegimeDecorator < DumbDelegator
          def initialize(regime, last_regime:)
            @last_regime = last_regime
            super(regime)
          end

          def changed?
            return true if last_regime.blank?

            regime_type_changed?
          end

          def regime_type_changed?
            last_regime&.type != type
          end

          def unchanged?
            !changed?
          end

          private

          attr_reader :last_regime
        end
      end
    end
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
renalware-core-2.0.159 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.158 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.157 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.156 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.155 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.153 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.152 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.151 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.149 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.148 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.147 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.146 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.145 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.144 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.143 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.142 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.141 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.140 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.139 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
renalware-core-2.0.138 app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb