Class: MandrillQueue::Message::Attachments
- Inherits:
-
Object
- Object
- MandrillQueue::Message::Attachments
show all
- Defined in:
- lib/mandrill_queue/message/attachments.rb
Direct Known Subclasses
Images
Defined Under Namespace
Modules: DSL
Classes: Attachment
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Attachments.
119
120
121
|
# File 'lib/mandrill_queue/message/attachments.rb', line 119
def initialize
@_attachments = []
end
|
Instance Method Details
#add(*args, &block) ⇒ Object
123
124
125
|
# File 'lib/mandrill_queue/message/attachments.rb', line 123
def add(*args, &block)
@_attachments << attachment_class.new(*args, &block)
end
|
#attachment_class ⇒ Object
127
128
129
|
# File 'lib/mandrill_queue/message/attachments.rb', line 127
def attachment_class
@_klass ||= Attachment
end
|
#attachments ⇒ Object
153
154
155
|
# File 'lib/mandrill_queue/message/attachments.rb', line 153
def attachments
@_attachments
end
|
#count ⇒ Object
131
132
133
|
# File 'lib/mandrill_queue/message/attachments.rb', line 131
def count
@_attachments.count
end
|
#load_all ⇒ Object
135
136
137
|
# File 'lib/mandrill_queue/message/attachments.rb', line 135
def load_all
@_attachments.each(&:load_file)
end
|
#set!(list) ⇒ Object
145
146
147
148
149
150
151
|
# File 'lib/mandrill_queue/message/attachments.rb', line 145
def set!(list)
@_attachments = list.map do |obj|
attachment_class.new.set!(obj.symbolize_keys)
end
self
end
|
#to_a(options = {}) ⇒ Object
139
140
141
142
143
|
# File 'lib/mandrill_queue/message/attachments.rb', line 139
def to_a(options = {})
@_attachments.map do |a|
a.to_hash(options)
end
end
|
#validate(errors, options = {}) ⇒ Object
157
158
159
160
161
|
# File 'lib/mandrill_queue/message/attachments.rb', line 157
def validate(errors, options = {})
@_attachments.each do |a|
a.validate(errors, options)
end
end
|