Sha256: bf579d138c203ffc9a42db2f7ea5e5fcf5134287b8e3c301733550cf10c09672
Contents?: true
Size: 647 Bytes
Versions: 6
Compression:
Stored size: 647 Bytes
Contents
module Slacken::Filters # Public: Convert emoji image nodes to emoji nodes. class StringfyEmoji < Slacken::Filter def call(component) if emoji_img_tag?(component) component.class.new(:emoji, [], content: component.attrs[:alt]) else component.derive(component.children.map(&method(:call))) end end def valid?(component) if emoji_img_tag?(component) false else component.children.all?(&method(:valid?)) end end private def emoji_img_tag?(component) component.type.member_of?(:img) && component.attrs[:class].include?('emoji') end end end
Version data entries
6 entries across 6 versions & 1 rubygems