class HTML::Pipeline::ImageFilter
HTML
Filter
that converts image's url into <img> tag. For example, it will convert
http://example.com/test.jpg
into
<img src="http://example.com/test.jpg" alt=""/>.
Public Instance Methods
call()
click to toggle source
# File lib/html/pipeline_plus/image_filter.rb, line 10 def call @text.gsub(/(https|http)?:\/\/.+\.(jpg|jpeg|bmp|gif|png)(\?\S+)?/i) do |match| %(<img src="#{match}" alt=""/>) end end