Class: SimpleImagesDownloader::Validatable::MimeTypeValidator
- Inherits:
-
Validator
- Object
- Validator
- SimpleImagesDownloader::Validatable::MimeTypeValidator
- Extended by:
- Forwardable
- Defined in:
- lib/simple_images_downloader/validatable/mime_type_validator.rb
Overview
MimeTypeValidator class Responsible for validating mime type of file
Instance Method Summary collapse
-
#validate(options) ⇒ Object
Validates mime type of file.
Instance Method Details
#validate(options) ⇒ Object
Validates mime type of file. The mime types are taken from file Configuration
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/simple_images_downloader/validatable/mime_type_validator.rb', line 21 def validate() path = [:path] io = [:io] mime_type = mime_type_of(io) return if SimpleImagesDownloader::Configuration.valid_mime_types.include?(mime_type) raise Errors::BadMimeType.new(path, mime_type) end |