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.1.1 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.1.0 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.167 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.166 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.165 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.164 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.163 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.162 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.161 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.160 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.159 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.158 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.157 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.156 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.155 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.153 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.152 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.151 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.149 app/models/renalware/hd/revise_hd_profile.rb
renalware-core-2.0.148 app/models/renalware/hd/revise_hd_profile.rb