Sha256: 77a58839787f15df0f0a0154e18e49db43d4e09c491640de1265d2eb867c8346

Contents?: true

Size: 807 Bytes

Versions: 2

Compression:

Stored size: 807 Bytes

Contents

# frozen_string_literal: true

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

          attr_accessor :elements, :border

          def initialize(border: nil)
            @elements = []
            @border = border

            yield(self) if block_given?
          end

          def append(element)
            @elements << element

            self
          end

          def as_json(*)
            {
              type: TYPE,
              border: @border,
              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_preformatted.rb
slack-ruby-block-kit-0.24.0 lib/slack/block_kit/layout/rich_text/rich_text_preformatted.rb