Class: Mailboxer::RecipientFilter
- Inherits:
-
Object
- Object
- Mailboxer::RecipientFilter
- Defined in:
- lib/mailboxer/recipient_filter.rb
Instance Attribute Summary collapse
-
#mailable ⇒ Object
readonly
Returns the value of attribute mailable.
-
#recipients ⇒ Object
readonly
Returns the value of attribute recipients.
Instance Method Summary collapse
-
#call ⇒ Object
recipients can be filtered on a conversation basis.
-
#initialize(mailable, recipients) ⇒ RecipientFilter
constructor
A new instance of RecipientFilter.
Constructor Details
#initialize(mailable, recipients) ⇒ RecipientFilter
Returns a new instance of RecipientFilter.
4 5 6 |
# File 'lib/mailboxer/recipient_filter.rb', line 4 def initialize(mailable, recipients) @mailable, @recipients = mailable, recipients end |
Instance Attribute Details
#mailable ⇒ Object (readonly)
Returns the value of attribute mailable.
3 4 5 |
# File 'lib/mailboxer/recipient_filter.rb', line 3 def mailable @mailable end |
#recipients ⇒ Object (readonly)
Returns the value of attribute recipients.
3 4 5 |
# File 'lib/mailboxer/recipient_filter.rb', line 3 def recipients @recipients end |
Instance Method Details
#call ⇒ Object
recipients can be filtered on a conversation basis
9 10 11 12 13 14 15 |
# 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 |