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