Class: Slack::BlockKit::Layout::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/slack/block_kit/layout/header.rb

Overview

A header is a plain-text block that displays in a larger, bold font. Use it to delineate between different groups of content in your app’s surfaces.

api.slack.com/reference/block-kit/blocks#header

Constant Summary collapse

TYPE =
'header'

Instance Method Summary collapse

Constructor Details

#initialize(text:, block_id: nil, emoji: nil) ⇒ Header

Returns a new instance of Header.



14
15
16
17
# File 'lib/slack/block_kit/layout/header.rb', line 14

def initialize(text:, block_id: nil, emoji: nil)
  @text = Composition::PlainText.new(text: text, emoji: emoji)
  @block_id = block_id
end

Instance Method Details

#as_jsonObject



19
20
21
22
23
24
25
# File 'lib/slack/block_kit/layout/header.rb', line 19

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