Sha256: c2b94e25fb71ae467d81affb6da9532a3724d83e6015312ff2bfc98bf6770b6d

Contents?: true

Size: 885 Bytes

Versions: 95

Compression:

Stored size: 885 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/events"

module Renalware
  module Events
    class EventPdfPresenter < SimpleDelegator
      class DefaultHospitalCentreNotFoundError < StandardError; end
      class DefaultHospitalCentreNotSetError < StandardError; end

      delegate :info,
               :trust_name,
               :trust_caption,
               to: :hospital_centre, prefix: true, allow_nil: true

      private

      def hospital_centre
        @hospital_centre ||= begin
          centre = Renalware::Hospitals::Centre.find_by(code: default_hospital_centre_code)
          centre.presence || raise(DefaultHospitalCentreNotFoundError, default_hospital_centre_code)
        end
      end

      def default_hospital_centre_code
        Renalware.config.ukrdc_site_code.presence || raise(DefaultHospitalCentreNotSetError)
      end
    end
  end
end

Version data entries

95 entries across 95 versions & 1 rubygems

Version Path
renalware-core-2.0.127 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.126 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.125 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.124 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.123 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.121 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.120 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.119 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.118 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.117 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.116 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.115 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.113 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.112 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.111 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.110 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.109 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.108 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.106 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.105 app/presenters/renalware/events/event_pdf_presenter.rb