Class: Fiddler::AttachmentCollection
- Inherits:
-
Array
- Object
- Array
- Fiddler::AttachmentCollection
- Defined in:
- lib/fiddler/attachment.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.fill(*args) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fiddler/attachment.rb', line 12 def self.fill(*args) AttachmentCollection.new Array(args.compact).flatten.map { || if .is_a?(File) AttachmentFile.new(.path) elsif .is_a?(String) AttachmentFile.new() elsif .is_a?(ActionDispatch::Http::UploadedFile) AttachmentFile.new(.tempfile.path, .original_filename) end }.compact end |
Instance Method Details
#to_payload ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/fiddler/attachment.rb', line 4 def to_payload hash = Hash.new self.each_with_index do |attach, index| hash["attachment_#{index+1}"] = attach end hash end |