Check if string contains any substring in an array in Ruby

后端 未结 5 1499
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-28 12:25

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

5条回答
  •  独厮守ぢ
    2020-12-28 13:05

    # will be true if the content type is included    
    VALID_CONTENT_TYPES.include? attachment.content_type.gsub!(/^(image\/[a-z]+).+$/, "\1") 
    

提交回复
热议问题