class Mailboxer::RecipientFilter

Attributes

mailable[R]
recipients[R]

Public Class Methods

new(mailable, recipients) click to toggle source
# File lib/mailboxer/recipient_filter.rb, line 4
def initialize(mailable, recipients)
  @mailable, @recipients = mailable, recipients
end

Public Instance Methods

call() click to toggle source

recipients can be filtered on a conversation basis

# File lib/mailboxer/recipient_filter.rb, line 9
def call
  return recipients unless mailable.respond_to?(:conversation)

  recipients.each_with_object([]) do |recipient, array|
    array << recipient if mailable.conversation.has_subscriber?(recipient)
  end
end