Sha256: dd99e2bf7823c95f4e430e3ad73cfec4b4f0667daa7abf6cccbfc331c6cc1e61
Contents?: true
Size: 712 Bytes
Versions: 17
Compression:
Stored size: 712 Bytes
Contents
require_dependency "renalware/letters" require "attr_extras" 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? 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
17 entries across 17 versions & 1 rubygems