class Slacken::Filters::ReplaceUnsupportedImgs
Public: Replace unsupported images by placeholder.
Public Instance Methods
call(component)
click to toggle source
# File lib/slacken/filters/replace_unsupported_imgs.rb, line 4 def call(component) if img_with_data_uri?(component) component.class.new( :text, [], content: '<img src="data:...">' ) else component.derive( component.children.map(&method(:call)), ) end end
Private Instance Methods
img_with_data_uri?(component)
click to toggle source
# File lib/slacken/filters/replace_unsupported_imgs.rb, line 18 def img_with_data_uri?(component) component.type.member_of?(:img) && (component.attrs[:src] || '') =~ /^data:/i end