Sha256: db4e65c46e68a3d14be804a94db5c85d51036fb61269436558f9fd0619ac6dd3
Contents?: true
Size: 755 Bytes
Versions: 10
Compression:
Stored size: 755 Bytes
Contents
# frozen_string_literal: true require_dependency "renalware/letters" module Renalware module Letters module Delivery # A (non-pundit) policy driving logic around whether to email the letter to the practice class DeliveryPolicy pattr_initialize :letter delegate :patient, :recipients, to: :letter delegate :practice, to: :patient def email_letter_to_practice? email = PracticeEmail.new(letter).address email.present? && gp_recipient.present? && gp_recipient.emailed_at.blank? end def gp_is_a_recipient? gp_recipient.present? end def gp_recipient recipients.find(&:primary_care_physician?) end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems