Class: Slack::BlockKit::Composition::PlainText

Inherits:
Object
  • Object
show all
Defined in:
lib/slack/block_kit/composition/plain_text.rb

Overview

An object containing some text, formatted using plain text.

api.slack.com/reference/messaging/composition-objects#text

Constant Summary collapse

TYPE =
'plain_text'

Instance Method Summary collapse

Constructor Details

#initialize(text:, emoji: nil) ⇒ PlainText

Returns a new instance of PlainText.



12
13
14
15
# File 'lib/slack/block_kit/composition/plain_text.rb', line 12

def initialize(text:, emoji: nil)
  @text = text
  @emoji = emoji
end

Instance Method Details

#as_jsonObject



17
18
19
20
21
22
23
# File 'lib/slack/block_kit/composition/plain_text.rb', line 17

def as_json(*)
  {
    type: TYPE,
    text: @text,
    emoji: @emoji
  }.compact
end