Class: Slackert::Blocks::Header

Inherits:
BlockElement show all
Defined in:
lib/slackert/blocks.rb

Overview

Header block element provides a title, rendered as a larger bold text on top of the message.

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ Header

Returns a new instance of Header.

Parameters:

  • text (String)

    header text



24
25
26
27
# File 'lib/slackert/blocks.rb', line 24

def initialize(text)
  super('header')
  @text = text
end

Instance Method Details

#to_slackObject



30
31
32
33
34
35
36
37
38
# File 'lib/slackert/blocks.rb', line 30

def to_slack
  {
    'type': @type,
    'text': {
      'type': 'plain_text',
      'text': @text
    }
  }
end