Class: Slack::BlockKit::Layout::RichText::RichTextPreformatted
- Inherits:
-
Object
- Object
- Slack::BlockKit::Layout::RichText::RichTextPreformatted
- Includes:
- RichTextElements
- Defined in:
- lib/slack/block_kit/layout/rich_text/rich_text_preformatted.rb
Overview
Constant Summary collapse
- TYPE =
'rich_text_preformatted'
Instance Attribute Summary collapse
-
#border ⇒ Object
Returns the value of attribute border.
-
#elements ⇒ Object
Returns the value of attribute elements.
Instance Method Summary collapse
- #append(element) ⇒ Object
- #as_json ⇒ Object
-
#initialize(border: nil) {|_self| ... } ⇒ RichTextPreformatted
constructor
A new instance of RichTextPreformatted.
Methods included from RichTextElements
#channel, #emoji, #link, #text, #user, #usergroup
Constructor Details
#initialize(border: nil) {|_self| ... } ⇒ RichTextPreformatted
Returns a new instance of RichTextPreformatted.
14 15 16 17 18 19 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_preformatted.rb', line 14 def initialize(border: nil) @elements = [] @border = border yield(self) if block_given? end |
Instance Attribute Details
#border ⇒ Object
Returns the value of attribute border.
12 13 14 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_preformatted.rb', line 12 def border @border end |
#elements ⇒ Object
Returns the value of attribute elements.
12 13 14 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_preformatted.rb', line 12 def elements @elements end |
Instance Method Details
#append(element) ⇒ Object
21 22 23 24 25 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_preformatted.rb', line 21 def append(element) @elements << element self end |
#as_json ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_preformatted.rb', line 27 def as_json(*) { type: TYPE, border: @border, elements: @elements.map(&:as_json) }.compact end |