Sha256: e00a2124a2a5435382b3789f8ab39a36b83f48c1c10ec31461a3d28bda8d6e46

Contents?: true

Size: 534 Bytes

Versions: 35

Compression:

Stored size: 534 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

35 entries across 35 versions & 1 rubygems

Version Path
renalware-core-2.0.46 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.45 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.44 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.43 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.42 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.41 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.40 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.39 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.38 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.37 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.36 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.35 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.34 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.33 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.32 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.31 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.30 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.28 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.27 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.26 app/models/renalware/hd/revise_hd_profile.rb