Sha256: 0339c05627224241fa49d0e68bd29ef9833b07a14e2f8328988d28db2711d342
Contents?: true
Size: 777 Bytes
Versions: 91
Compression:
Stored size: 777 Bytes
Contents
# frozen_string_literal: true 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? && 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
91 entries across 91 versions & 1 rubygems