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.147 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.146 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.145 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.144 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.143 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.142 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.141 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.140 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.139 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.138 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.137 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.136 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.135 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.134 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.133 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.132 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.131 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.130 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.129 app/presenters/renalware/events/event_pdf_presenter.rb
renalware-core-2.0.128 app/presenters/renalware/events/event_pdf_presenter.rb