Class: MandrillQueue::Message::Images::Image

Inherits:
Attachments::Attachment show all
Defined in:
lib/mandrill_queue/message/images.rb

Constant Summary

Constants inherited from Attachments::Attachment

Attachments::Attachment::ACCESSORS

Instance Method Summary collapse

Methods inherited from Attachments::Attachment

#content, #content64, #file, #file_loaded?, #initialize, #load_file, #name, #reset!, #set!, #to_hash, #type

Constructor Details

This class inherits a constructor from MandrillQueue::Message::Attachments::Attachment

Instance Method Details

#image_type?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/mandrill_queue/message/images.rb', line 8

def image_type?
	MIME::Types[/^image/].any? { |m| m == type }
end

#validate(errors, options = {}) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/mandrill_queue/message/images.rb', line 12

def validate(errors, options = {})
	options[:as] ||= :images
	super(errors, options)

	unless image_type?
		errors.push([options[:as], "Invalid image mime type."])
	end
end