Class: Slackened::BlockKit::Blocks::Text

Inherits:
Base
  • Object
show all
Defined in:
lib/slackened/block_kit/blocks/text.rb

Constant Summary collapse

MAX_LENGTH =
3000

Instance Attribute Summary

Attributes inherited from Base

#block

Instance Method Summary collapse

Methods inherited from Base

#set, #to_h

Constructor Details

#initialize(markdown) ⇒ Text

Returns a new instance of Text.



12
13
14
15
16
17
18
19
20
21
# File 'lib/slackened/block_kit/blocks/text.rb', line 12

def initialize(markdown)
	raise MaximumCharactersError, "#{markdown.length} can't be greater than #{MAX_LENGTH}" if markdown.length > MAX_LENGTH

	set({
		type: :mrkdwn,
		text: markdown
	})

	self
end