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.69 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.68 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.67 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.64 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.63 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.62 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.61 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.60 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.58 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.57 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.56 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.55 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.54 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.53 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.52 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.51 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.50 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.48 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.47 app/models/renalware/hd/revise_hd_profile.rb