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.
7 8 9 |
# File 'lib/zm/client/common/recipients.rb', line 7 def initialize @recipients = [] end |
Instance Method Details
#add(recipient) ⇒ Object
15 16 17 18 19 |
# File 'lib/zm/client/common/recipients.rb', line 15 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
21 22 23 24 25 26 27 28 |
# File 'lib/zm/client/common/recipients.rb', line 21 def del(recipient) case recipient when Recipient @recipients.delete(recipient) when 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
11 12 13 |
# File 'lib/zm/client/common/recipients.rb', line 11 def map(&block) @recipients.map(&block) end |