Sha256: 85a78be85cf36c0585fc1ddc443b7d577d9e884d5e246e1818acf6c54ba8e167

Contents?: true

Size: 1.11 KB

Versions: 19

Compression:

Stored size: 1.11 KB

Contents

require_dependency "renalware/letters"
require_dependency "renalware/address_presenter"

module Renalware
  module Letters
    class RecipientPresenter < DumbDelegator
      # We don't rely on `to_s` in this case as the string will not be marked as
      # HTML safe if we leave it to be implicitly called in the template.
      #
      def to_html
        AddressPresenter::Block.new(address_for_addressee).to_html
      end

      def address
        AddressPresenter.new(address_for_addressee)
      end

      private

      def address_for_addressee
        __getobj__.address
      end

      # @section sub-classes

      # The address for a recipient such as a primary care physician or a patient are
      # denormalized and stored with the recipient when the letter is archived.
      # Before the letter is archived, we display the current address directly
      # from the appropriate models ensuring the most recent address is presented.
      #
      class WithCurrentAddress < RecipientPresenter
        private

        def address_for_addressee
          __getobj__.current_address
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.rc11 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.rc10 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.rc9 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.rc8 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.rc7 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.rc6 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.rc5 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.rc4 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.rc3 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.rc1 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.beta12 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.beta11 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.beta10 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.beta9 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.beta8 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.beta7 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.beta6 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.beta5 app/presenters/renalware/letters/recipient_presenter.rb
renalware-core-2.0.0.pre.beta4 app/presenters/renalware/letters/recipient_presenter.rb