I am using the Tmail library, and for each attachment in an email, when I do attachment.content_type
, sometimes I get not just the content type but also the name. Examples:
image/jpeg; name=example3.jpg
image/jpeg; name=example.jpg
image/jpeg; name=photo.JPG
image/png
I have an array of valid content types like this:
VALID_CONTENT_TYPES = ['image/jpeg']
I would like to be able to check if the content type is included in any of the valid content types array elements.
What would be the best way of doing so in Ruby?
r = /#{words.map{|w|Regexp.escape(w)}.join('|')}/
– Eliseoelish