Class: Zm::Client::Recipients
- Inherits:
-
Object
- Object
- Zm::Client::Recipients
- Defined in:
- lib/zm/client/common/recipients.rb
Overview
Collection recipients
Instance Method Summary collapse
- #add(recipient) ⇒ Object
- #bcc ⇒ Object
- #cc ⇒ Object
- #clear ⇒ Object
- #del(recipient) ⇒ Object
- #from ⇒ Object
-
#initialize ⇒ Recipients
constructor
A new instance of Recipients.
- #map(&block) ⇒ Object
- #to ⇒ Object
Constructor Details
#initialize ⇒ Recipients
Returns a new instance of Recipients.
8 9 10 |
# File 'lib/zm/client/common/recipients.rb', line 8 def initialize @recipients = [] end |
Instance Method Details
#add(recipient) ⇒ Object
16 17 18 19 20 |
# File 'lib/zm/client/common/recipients.rb', line 16 def add(recipient) return unless recipient.is_a?(Recipient) @recipients.push(recipient) end |
#bcc ⇒ Object
42 43 44 |
# File 'lib/zm/client/common/recipients.rb', line 42 def bcc @recipients.select { |r| r.field == Recipient::BCC } end |
#cc ⇒ Object
38 39 40 |
# File 'lib/zm/client/common/recipients.rb', line 38 def cc @recipients.select { |r| r.field == Recipient::CC } end |
#clear ⇒ Object
30 31 32 |
# File 'lib/zm/client/common/recipients.rb', line 30 def clear @recipients.clear end |
#del(recipient) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/zm/client/common/recipients.rb', line 22 def del(recipient) if recipient.is_a?(Recipient) @recipients.delete(recipient) elsif recipient.is_a?(String) @recipients.delete_if { |r| r.email == recipient } end end |
#from ⇒ Object
46 47 48 |
# File 'lib/zm/client/common/recipients.rb', line 46 def from @recipients.select { |r| r.field == Recipient::FROM } end |
#map(&block) ⇒ Object
12 13 14 |
# File 'lib/zm/client/common/recipients.rb', line 12 def map(&block) @recipients.map(&block) end |
#to ⇒ Object
34 35 36 |
# File 'lib/zm/client/common/recipients.rb', line 34 def to @recipients.select { |r| r.field == Recipient::TO } end |