Sha256: 39e201d7f5b87bc5c3a19e55ac04391b28e5a53380168f057d0d7d00cf46251e

Contents?: true

Size: 710 Bytes

Versions: 2

Compression:

Stored size: 710 Bytes

Contents

# frozen_string_literal: true

module Slack
  module BlockKit
    module Layout
      class RichText
        # https://api.slack.com/reference/block-kit/blocks#rich_text_section
        class RichTextSection
          include RichTextElements
          TYPE = 'rich_text_section'

          attr_accessor :elements

          def initialize
            @elements = []

            yield(self) if block_given?
          end

          def append(element)
            @elements << element

            self
          end

          def as_json(*)
            {
              type: TYPE,
              elements: @elements.map(&:as_json)
            }.compact
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slack-ruby-block-kit-0.25.0 lib/slack/block_kit/layout/rich_text/rich_text_section.rb
slack-ruby-block-kit-0.24.0 lib/slack/block_kit/layout/rich_text/rich_text_section.rb