Sha256: 358be3f017ede3a2e39cdd313dd53e6723f860c78c2211b1d43f69f50068c88b

Contents?: true

Size: 535 Bytes

Versions: 39

Compression:

Stored size: 535 Bytes

Contents

# frozen_string_literal: true

module Renalware
  module HD
    class ReviseHDProfile
      def initialize(profile)
        raise(ArgumentError, "Cannot revise a new Profile") unless profile.persisted?

        @profile = profile
      end

      def call(params)
        profile.assign_attributes(params)
        return true unless profile.changed?
        return false unless profile.valid?

        profile.restore_attributes
        profile.supersede!(params)
      end

      private

      attr_reader :profile
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
renalware-core-2.0.89 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.88 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.87 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.86 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.85 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.84 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.83 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.82 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.81 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.80 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.79 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.78 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.77 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.76 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.75 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.74 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.73 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.72 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.71 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.70 app/models/renalware/hd/revise_hd_profile.rb