Sha256: 4245c8a0761b6e4c8f79e4d89430c747e44b15184725d383b5b6c2539836a00a

Contents?: true

Size: 504 Bytes

Versions: 1

Compression:

Stored size: 504 Bytes

Contents

class Slacken::DocumentComponent
  module StringfyEmoji
    # Private: Reject blank elements
    def stringfy_emoji
      if type.member_of?(:img) && attrs[:class].include?('emoji')
        self.class.new(:emoji, [], content: attrs[:alt])
      else
        derive(children.map(&:stringfy_emoji))
      end
    end

    def emoji_stringfied?
      if type.member_of?(:img) && attrs[:class].include?('emoji')
        false
      else
        children.all?(&:emoji_stringfied?)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slacken-0.1.0 lib/slacken/document_component/stringfy_emoji.rb