Sha256: 3f020b37f7487c6749978663bf78319ae77d8ef1b110a3f4481334a05210bd6a

Contents?: true

Size: 549 Bytes

Versions: 75

Compression:

Stored size: 549 Bytes

Contents

# frozen_string_literal: true

module Renalware
  module HD
    class ReviseHDProfile
      attr_reader :profile, :new_profile

      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
        @new_profile = profile.supersede!(params)
      end
    end
  end
end

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
renalware-core-2.0.147 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.146 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.145 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.144 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.143 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.142 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.141 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.140 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.139 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.138 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.137 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.136 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.135 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.134 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.133 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.132 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.131 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.130 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.129 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.128 app/models/renalware/hd/revise_hd_profile.rb